Python Practice › String Programs › Program 64
String to a list of words
Write a Python program to convert a string into a list of words.
Input
"learning python is fun"
Output
['learning', 'python', 'is', 'fun']
Approach
split().
Solution
print("learning python is fun".split())Output
['learning', 'python', 'is', 'fun']
Learn the concept
New to this topic? Read the lesson, then come back.