lundi 4 janvier 2021

Write a program to find out whether a given post is talking about "harry" or not using python? [duplicate]

So I am just starting to learn python. by watching some tutorials. in that tutorial he said to solve this question by using if else statements. but there is a issue that is the text "harry" can be in any order like upper case lower case for ex: "Harry", "HaRrY" "Harry". So I can't figure this out how to solve this. I just came this far. below is the code I did so far.

post = input("Enter a post: ")
if ("HARRY" in post):
    find = True
elif ("harry" in post):
    find = True
else: 
    find = False

if (find):
    print("Yes! the post contains the name Harry.")
else: 
    print("No! the post does not contain the name Harry")

Aucun commentaire:

Enregistrer un commentaire