'Ranging over a slice

my problem is that Im only allowed to use the command PrintRune, i must range over a string and print one by one the characters of any string

package piscine

import "github.com/01-edu/z01"

func PrintStr(s string) {
    slice := []string{
        s,
    }
    for x, word := range slice {
        z01.PrintRune(rune(word[x]))
    }
}

here's my code, this only prints the first character of the string, how can i make the slice continue until the end of the given string please ?

go


Solution 1:[1]

Here is the code snippets:

package piscine

import "github.com/01-edu/z01"

func PrintStr(s string) {
    slice := []string{
        s,
    }
    for _, word := range slice {
        for _, r := range word {
            z01.PrintRune(rune(r))
        }
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Prakash P