the-honk/school/gcse/year 9/python challenges/14 - 'the' counter.py
2021-12-21 19:46:28 +00:00

9 lines
No EOL
218 B
Python

sentence = str(input('Please input a sentence.'))
words = sentence.split()
theCount = 0
for word in words:
if str.lower(word) == 'the':
theCount = theCount + 1
print('"The" appears ', theCount, " times.")