+ 1
How to divide a sentence into words and make each word a separate member of an array in python.
4 ответов
+ 7
Praise Banda ,
we can use the string method split() like:
words = input().split() # this generates a list of words from the sentence that has been input.
by using a sentence for input: "this is magic" , the resulting list is: ["this", "is", "magic"]
happy coding
+ 7
You can use function split on spaces.
https://code.sololearn.com/cd89N09f7P0R/?ref=app
+ 2
Thanks for the help. I completely forgot about the split function😅
+ 2
Use .split