find_keyword read keywords.txt from top to bottom and test each word against your sentence. It stops at the first match — first in the file, not in the sentence. A sentence without a keyword costs the most: every line has to be checked.Keyboard: → or space step, ← back, p play/pause, e result, r reset.
Built to accompany COSC 1210 (CS I, Python), lectures “Spot a keyword” and “The first reply”. The search runs live on whatever sentence you type, with the ten words of keywords.txt from class. The whole-word test uses a pattern from the lecture on regular expressions: re.search(r"\b" + word + r"\b", sentence.lower()).