Write Python code to find the number of words in a string input by the user.
Answer:
Code:
str=input(
"Enter a string: "
)
words=str.split()
print(len(words))
Short Answer Type Questions (2/3 Marks each)
Last updated at April 16, 2024 by Teachoo
Answer:
Code:
str=input(
"Enter a string: "
)
words=str.split()
print(len(words))