+ 2

Lists

How I can convert a Input with several words to a useful list without splitting up the words in letters?

1st Apr 2022, 5:30 AM
Tremor
Tremor - avatar
4 ответов
0
In Python, you can use the split() function. By default, it detects whitespaces on a string to split it into a list. sentence = input() words = sentence.split() print(words)
1st Apr 2022, 6:48 AM
Orisa
Orisa - avatar
+ 4
s = input().split() print(s) # -1 line
1st Apr 2022, 9:14 AM
CodeStory
CodeStory - avatar
+ 3
s = ['Solo','Learn','!!!'] # N:1 for i in s: print(i, end='') #N:2 print(''.join(s)) #N:3 …..
1st Apr 2022, 5:38 AM
CodeStory
CodeStory - avatar
0
What did you mean with a useful list? useful for what?
1st Apr 2022, 6:00 AM
Ipang