the-honk/gcse computer science/year 9/python challenges/14 - 'the' counter.py
2021-09-14 21:57:23 +01: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.")