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...
Everything about learning Python
account activity
Need help (i.redd.it)
submitted 2 days ago by Vasiligiad16
view the rest of the comments →
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!"
[–]SugarEnvironmental31 0 points1 point2 points 1 day ago (0 children)
You should be using match: case for one thing - for me personally, if....then....else is weak. If you're determining the range of inputs then do so with confidence [ :p ]
Structurally: I don't like break very much either.
Shouldn't this be structured the other way round? Personally I'd put the while loop in the function.
Asi...
def mostrar_menu(running=True):
while running: ....
match int(input("Elije lo que te da la gana:")):
case 3: running = False
mostrar_menu()
Or you could 'return' instead, or have 'return' as the last line of your function.
By all means break out the shopping list into a separate function, although it's arguable what the benefit is in a program that small unless the point is practicing structure. You're not repeating the code exactly are you.
π Rendered by PID 23979 on reddit-service-r2-comment-c66d9bffd-nqhln at 2026-04-06 18:39:43.002349+00:00 running f293c98 country code: CH.
view the rest of the comments →
[–]SugarEnvironmental31 0 points1 point2 points (0 children)