句子长度.py 277 B

12345678
  1. def count(sentence):
  2. words = sentence.split()
  3. total_words = len(words)
  4. for word in words:
  5. print(f"单词:{word},长度:{len(word)}")
  6. print(f"整个句子的总单词数:{total_words}")
  7. sentence = input("请输入一个句子:")
  8. count(sentence)