May-01-2022, 05:07 AM
(This post was last modified: May-01-2022, 05:07 AM by Pedroski55.)
I use while loops like this a lot, but I always need to get an answer that is in my list or dictionary.
It occurred to me this morning that you don't have a check to see if the entry is in your "shop".
Use dict.get(key) to check, or you will get an error later when adding the calories.
It occurred to me this morning that you don't have a check to see if the entry is in your "shop".
Use dict.get(key) to check, or you will get an error later when adding the calories.
mychoices = [] while True: choice = input('Copy and paste a choccy from the list above you fat slob ... ') if choice == 'q': break while sweets.get(choice) == None: choice = input('You gotta choose a choccy from the list above you lipose lump ... ') mychoices.append(choice)Don't forget to add this at the end of the program!
Quote:print('No wonder the bathroom scales always say, "Only one person at a time please!"')