+ 2
Can i iterate through a string
for example for 'hello'. is it possible to iterate to print h \n e \n l \n l \n o \n
1 ответ
+ 6
Yes, string's an iterable:
for char in string:
print(char)
That prints all the characters, each on separate line.