Hey I'm new to coding and while I was doing an assignment for my teacher I was trying to make my if statement accept two options for the conditional.
choice = input("What type of sandwich would you like today?\nYour options are: Chicken - $5.25, Beef - $6.35, or Tofu - $5.75 ")
if choice == ('Chicken' and 'chicken'):
print('You chose Chicken for $5.25.')
sandwich_total=(5.25)
confirm=input('Are you sure this is what you want? Y/N ')
if confirm == ('Y'):
print('Okay...')
elif confirm ==('N'):
intro()
The idea is that it would accept either chicken lower-cased or Chicken upper-cased and to me it would make sense if it accepted or but it doesn't...It accepts and. The way I was taught and would only work if both conditions are true while or would only work if one of the conditions were true but when i use or it finishes the code.
Aucun commentaire:
Enregistrer un commentaire