the-honk/school/gcse/year 9/python challenges/14 - 'the' counter.py

9 lines
218 B
Python
Raw Normal View History

2024-10-09 17:02:27 +00:00
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.")