samedi 22 septembre 2018

Having trouble updating python input into lowercase

So I am trying to create a program that takes in a customer choice of food. I want the user to be able to input their choice in capitals so I can then convert it to lowercase and then compare it using an if statement

Name = str(input("What is your Name?"))
Name = ''.join(Name.split())
foodChoice = str(input("Would you like a Burger or Salad?"))
foodChoice = foodChoice.lower()

if foodChoice == 'burger':
    print("true")
else:
    print("false")

Let's assume the customer inputs "BurgER"

The problem I'm experience is that even after I convert "BurgER" into lowercase after the input is declared, the if statement still regards it as false...

Aucun commentaire:

Enregistrer un commentaire