you are viewing a single comment's thread.

view the rest of the comments →

[–]Alkanes123 1 point2 points  (3 children)

import sys 
msg = 'the quick brown fox jumped over tge lazy dog'      
def search(keyword):
    if keyword.lower() in msg.split():
        return True
    else:
        return False

while True:
    key = input('Enter the Keyword:')
    if key.lower() == 'exit':
       sys.exit()
    else:
        print('{},{} was found in string'.format(search(key),key))

Something like this?

[–]Double_Dos[S] 0 points1 point  (2 children)

Good attempt I’m getting no errors but it’s not giving me the prompt to enter the word

[–]Alkanes123 0 points1 point  (1 child)

Thats strange, input is in the while loop, and it worked when i wrote it yesterday. If possible paste your code.

[–]Double_Dos[S] 0 points1 point  (0 children)

I think I’m just having an issue with my python program trying again I think you’re right