Python Practice › String Programs › Program 64

String to a list of words

EasyString Programs · 64 of 106

Write a Python program to convert a string into a list of words.

Advertisement
Input
"learning python is fun"
Output
['learning', 'python', 'is', 'fun']

Approach

  1. split().

Solution

Python
print("learning python is fun".split())
Output
['learning', 'python', 'is', 'fun']

Learn the concept

New to this topic? Read the lesson, then come back.

More string programs

← All 106 String Programs

Leave a Comment