0

I'm a python newbie and I know this is super simple by I can't find the proper answer. I wrote some code to annoy my friend George that's designed to say 'this person is cool' for any answer you input except 'George'

uncool = "George"
if input("Who do you think is cool?\n") == uncool:
    print("this person is not cool")
else:
    print("This person is cool")

I know this is simple: I want to make it so that both "George" and "george" are values for the 'uncool' variable. I've tried putting them both in a list, but that meant that typing just 'George' or 'george' on its own didn't work anymore. How do i edit this code so the if statement is triggered by multiple different values?

2 Answers2

0

You simply need to use lower() function in your code:

uncool = "George".lower()
if input("Who do you think is cool?\n").lower() == uncool:
    print("this person is not cool")
else:
    print("This person is cool")

Result:

Who do you think is cool?
george
this person is not cool

Another result:

Who do you think is cool?
gEorge
this person is not cool
Saeed
  • 3,255
  • 4
  • 17
  • 36
  • 1
    In [How to Answer](https://stackoverflow.com/help/how-to-answer), note the section *Answer Well-Asked Questions*, and therein the bullet point regarding questions that "have been asked and answered many times before". – Charles Duffy Dec 14 '20 at 19:25
  • 1
    Fix your answer. Your Result section is not the result. Besides, you should use lower() on the input value as well. – RufusVS Dec 14 '20 at 19:27
-1
userinput = input("Who do you think is cool?\n")
if userinput  == "George" or userinput == "george":
    print("this person is not cool")
else:
    print("This person is cool")
Cagri
  • 307
  • 3
  • 13