Write a program which accepts a string and counts the number of words in it
Topic: Write a program which accepts a string and counts the number of words in it
Solution
def num_of_words(st): return len(st.split())
List all Python Programs
Solution
def num_of_words(st): return len(st.split())