python counts the number of words in the input string

Go directly to the code, explain in the comments, if you don’t understand the comments, you must return

'''
3 统计所输入字符串中单词的个数
'''
#单词严格以空格分开
s = str(input()) 
print(len(s.split(" ")))

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325717187&siteId=291194637