Uhh, i was wondering if i had a single word such as dog, how would i convert that into an array of [d,o,g]? I thought i could use the .split function but i doesn’t work with an empty separator. I know the doubt is kind of basic, but i’m still confused, thanks in advance.
A string is another type of iterable, where the characters are iterated over.
text = "dog" for element in text: print(element) # d # o # g
This means you just need to directly convert the elements to a list:
text = "dog" characters =  for character in text: characters.append(character) print(characters) # ['d', 'o', 'g']
There’s list-comprehension short-hand for the above:
text = "dog" characters = [c for c in text] print(characters) # ['d', 'o', 'g']
The above is the main function of the
characters = list("dog") print(characters) # ['d', 'o', 'g']
> list('dog') ['d', 'o', 'g']