0

Is there any possible ways to separate the whole string.

If my input is#hello world, I want the output of #hello in the first line and #world in the next line.

1st May 2020, 4:11 PM
Lavanya T
Lavanya T - avatar
5 ответов
+ 2
You can use split() for that
1st May 2020, 4:12 PM
Prince
+ 1
Yes.. We can seperate whole sentence into words.. Here is my Code... https://code.sololearn.com/cwOe04m15gTW/?ref=app
1st May 2020, 4:35 PM
Eswar V
+ 1
Simply a="hello world" print("\n".join(a.split()))
1st May 2020, 4:56 PM
Abhay
Abhay - avatar
0
Tq
1st May 2020, 4:12 PM
Lavanya T
Lavanya T - avatar
0
for x in "hello world": print(x, end='') if x == ' ': print() If you want the '#' too, then use split() as mentioned previously.
1st May 2020, 4:59 PM
rodwynnejones
rodwynnejones - avatar