Skip to content

Commit b17d61f

Browse files
authored
Corrected the formatting of code
1 parent 3819d50 commit b17d61f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

contrib/mini-projects/wordcounter.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,16 @@ The provided code defines a Python function count_words(sentence) aimed at count
3131
Finally, it prints out the number of words in the sentence.
3232

3333
def count_words(sentence):
34-
# Split the sentence into words
35-
words = sentence.split()
34+
# Split the sentence into words
35+
words = sentence.split()
3636

37-
# Count the number of words
38-
word_count = len(words)
39-
40-
return word_count
37+
# Count the number of words
38+
word_count = len(words)
4139

40+
return word_count
41+
4242
# Example usage:
4343
sentence = input("Enter a sentence: ")
4444
number_of_words = count_words(sentence)
4545
print("Number of words:", number_of_words)
46+

0 commit comments

Comments
 (0)