Banging my head against the wall for a simple task. .lower() not working /u/Wu_tang_dan Python Education

Working through a Python introductory course and one of the milestones is this super basic menu program. Its been a lot of fun so far but this program is only written with the input requiring the beginning letter to be capitalized, which is dumb. Please see below:

drinkDetails=””

drink = input(‘What type of drink would you like to order?nWaternCoffeenTeanEnter your choice:’)

if drink ==”Water”:

drinkDetails=drink 

elif drink==”Coffee”:

drinkDetails=drink 

elif drink==”Tea”:

drinkDetails=drink 

else:

print("Sorry, that item is not available (did you read the menu?)") 

print(“Your drink selection: “,drinkDetails)

So if I dont put “Water” or “Coffee” exactly, I get the “Sorry, that item is not available”. So I tried adding .lower() to the input options.

drinkDetails=””

drink = input(‘What type of drink would you like to order?nWaternCoffeenTeanEnter your choice:’)

if drink.lower() ==”Water”:

drinkDetails=drink 

elif drink==”Coffee”:

drinkDetails=drink 

elif drink==”Tea”:

drinkDetails=drink 

else:

print("Sorry, that item is not available (did you read the menu?)") 

print(“Your drink selection: “,drinkDetails)

But now no variance of “Water” works, I get the “Sorry” message for “water”, “Water”, and “WATER” (Coffee and Tea still work).

I dont understand what Im doing wrong. Can anyone shed some light?

Thanks.

submitted by /u/Wu_tang_dan
[link] [comments]

​r/learnpython Working through a Python introductory course and one of the milestones is this super basic menu program. Its been a lot of fun so far but this program is only written with the input requiring the beginning letter to be capitalized, which is dumb. Please see below: drinkDetails=”” drink = input(‘What type of drink would you like to order?nWaternCoffeenTeanEnter your choice:’) if drink ==”Water”: drinkDetails=drink elif drink==”Coffee”: drinkDetails=drink elif drink==”Tea”: drinkDetails=drink else: print(“Sorry, that item is not available (did you read the menu?)”) print(“Your drink selection: “,drinkDetails) So if I dont put “Water” or “Coffee” exactly, I get the “Sorry, that item is not available”. So I tried adding .lower() to the input options. drinkDetails=”” drink = input(‘What type of drink would you like to order?nWaternCoffeenTeanEnter your choice:’) if drink.lower() ==”Water”: drinkDetails=drink elif drink==”Coffee”: drinkDetails=drink elif drink==”Tea”: drinkDetails=drink else: print(“Sorry, that item is not available (did you read the menu?)”) print(“Your drink selection: “,drinkDetails) But now no variance of “Water” works, I get the “Sorry” message for “water”, “Water”, and “WATER” (Coffee and Tea still work). I dont understand what Im doing wrong. Can anyone shed some light? Thanks. submitted by /u/Wu_tang_dan [link] [comments] 

Working through a Python introductory course and one of the milestones is this super basic menu program. Its been a lot of fun so far but this program is only written with the input requiring the beginning letter to be capitalized, which is dumb. Please see below:

drinkDetails=””

drink = input(‘What type of drink would you like to order?nWaternCoffeenTeanEnter your choice:’)

if drink ==”Water”:

drinkDetails=drink 

elif drink==”Coffee”:

drinkDetails=drink 

elif drink==”Tea”:

drinkDetails=drink 

else:

print("Sorry, that item is not available (did you read the menu?)") 

print(“Your drink selection: “,drinkDetails)

So if I dont put “Water” or “Coffee” exactly, I get the “Sorry, that item is not available”. So I tried adding .lower() to the input options.

drinkDetails=””

drink = input(‘What type of drink would you like to order?nWaternCoffeenTeanEnter your choice:’)

if drink.lower() ==”Water”:

drinkDetails=drink 

elif drink==”Coffee”:

drinkDetails=drink 

elif drink==”Tea”:

drinkDetails=drink 

else:

print("Sorry, that item is not available (did you read the menu?)") 

print(“Your drink selection: “,drinkDetails)

But now no variance of “Water” works, I get the “Sorry” message for “water”, “Water”, and “WATER” (Coffee and Tea still work).

I dont understand what Im doing wrong. Can anyone shed some light?

Thanks.

submitted by /u/Wu_tang_dan
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *