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.
5 Answers
+ 2
You can use split() for that
+ 1
Yes..
We can seperate whole sentence into words..
Here is my Code...
https://code.sololearn.com/cwOe04m15gTW/?ref=app
+ 1
Simply
a="hello world"
print("\n".join(a.split()))
0
Tq
0
for x in "hello world":
print(x, end='')
if x == ' ':
print()
If you want the '#' too, then use split() as mentioned previously.