How to split strings ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to split strings ?

What should I do for changing this code↓    str_Hello = input('Say Hello:') to this↓    L_Hello = [ 'H' , 'e' , 'l' , 'l' , 'o' ]

22nd Jan 2019, 2:34 PM
Shumpei Sori
Shumpei Sori - avatar
2 Answers
+ 5
str_Hello = input(’Say Hello: ’) L_Hello = list(str_Hello) print(L_Hello)
22nd Jan 2019, 2:54 PM
Jax
Jax - avatar
+ 2
You can use: str.split(separator) -str: string you're using strHello = "Hello world" str = strHello.split()
22nd Jan 2019, 2:54 PM
AngelinG
AngelinG - avatar