[Tutor] Python user input and return

Mats Wichmann mats at wichmann.us
Sat Sep 4 20:19:01 EDT 2021


On 9/4/21 11:31 AM, chandar pass wrote:
> I am trying to have a user pick an item from a list I have created, and if
> it is in the list they get a response, if not they should try again. I am
> having a hard time with this one for some reason.  Here is what I have so
> far.  all of my "user_choice" gets returned. Any kind of help would be
> greatly appreciated. Thanks
> 
> user_choice = ("kimura", "wrist lock", "cross choke")
> input("What is your second favorite Jits move? :")

you need to save this.

you don't have a check for whether the input value is one of the 
possibilities.

> print("{} is a sweet submission!".format(user_choice))
here you're not printing what the user selected, but the tuple of 
possible choices you defined above.



More information about the Tutor mailing list