Create the PrintSlice() function

Report a typo

Suppose you wanted to create a very simple generic function PrintSlice(). It should take a slice of any type as an argument, and print all of the elements of the slice in a single line.

We have written part of the code for PrintSlice() function for you, your task is to finish implementing it.

Sample Input 1:

A B C
1 2 3

Sample Output 1:

ABC123
Write a program in Go
package main

import "fmt"

// Make PrintSlice() a generic function that can take any type of slice
// Remember that it should print the slice elements in a single line!
func PrintSlice[? ?](s []?) {
for _, v := range s {
?
}
}

// DO NOT delete or modify the contents within the main function!
func main() {
var str1, str2, str3 string
fmt.Scanln(&str1, &str2, &str3)

var num1, num2, num3 int
fmt.Scanln(&num1, &num2, &num3)

stringSlice := []string{str1, str2, str3}
intSlice := []int{num1, num2, num3}

PrintSlice(stringSlice)
PrintSlice(intSlice)
}
___

Create a free account to access the full topic