Convert a string into a list of words.

In this program, we will take a string as input and convert a string into a list of words.

Steps to solve the program
  1. Take a string as input.
  2. Convert the string into a list of words using split().
  3. Print the output.
				
					#Input string
string = "learning python is fun"
list1 = string.split(" ")

#Printing output
print(list1)
				
			

Output :

				
					['learning', 'python', 'is', 'fun']
				
			

check whether a string contains all letters of the alphabet or not.

swap commas and dots in a string.

Leave a Comment