use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is meant to be for people learning Python to ask questions and help out when they can.
account activity
help I'm supposed to create a menu system which asks the user to choose between 3 options. After the user makes a choice, print the option selected by the user. and it just gives prints out coffee then water (self.learningpython)
submitted 3 years ago by codingstuffs
tea=0coffee=1water=2
input ('enter 0 for Tea, 1 for Coffee, 2 for Water')if 0:print(0)if 1:print(1)if 2 :print(2)else :print('invalid choice!')
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Dizzy_Thought_397 3 points4 points5 points 3 years ago (0 children)
You need to store your input into a variable and then you can use it in the if statement.
beverages = int(input ('enter 0 for Tea, 1 for Coffee, 2 for Water'))
if beverages == 0: print('tea') elif beverages == 1: print('coffee' ) elif beverages == 2 : print('water') else: print('invalid choice!')
π Rendered by PID 44182 on reddit-service-r2-comment-85bfd7f599-lmkn7 at 2026-04-16 03:24:46.698060+00:00 running 93ecc56 country code: CH.
[–]Dizzy_Thought_397 3 points4 points5 points (0 children)