compter les mots python

str = "Programming is fun"

# Use split to decompose str into words
# delimiters are assumed to be white space characters
words = str.split()

print("Words count:", len(words))  # Words count: 3
Wissam