Write a program to print number of words in a string


Topic: Write a program to print number of words in a string

Solution

str1 = 'It is a glorious day'
res = len(str1.split()) 
  
print("The number of words in string are : " + str(res)) 



List all Python Programs