Corrected the formatting of code

pull/223/head
Arpna 2024-05-17 08:35:09 +05:30 zatwierdzone przez GitHub
rodzic 3819d50869
commit b17d61f5a0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 7 dodań i 6 usunięć

Wyświetl plik

@ -31,15 +31,16 @@ The provided code defines a Python function count_words(sentence) aimed at count
Finally, it prints out the number of words in the sentence.
def count_words(sentence):
# Split the sentence into words
words = sentence.split()
# Split the sentence into words
words = sentence.split()
# Count the number of words
word_count = len(words)
return word_count
# Count the number of words
word_count = len(words)
return word_count
# Example usage:
sentence = input("Enter a sentence: ")
number_of_words = count_words(sentence)
print("Number of words:", number_of_words)