-2

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 an 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):
    print("Yes! the post contains the name Harry.")
elif ("harry" in post):
    print("Yes! the post contains the name Harry.")
else: 
    print("No! the post does not contain the name Harry")
vitaliis
  • 4,082
  • 5
  • 18
  • 40
Shahadat
  • 1
  • 1
  • 1

1 Answers1

0

You could try lowering:

post = input("Enter a post: ")
if 'harry' in post.lower():
    print("Yes! the post contains the name Harry.")
else:
    print("No! the post does not contain the name Harry")
U13-Forward
  • 69,221
  • 14
  • 89
  • 114