Apr-30-2022, 11:35 AM
Or if you just want to use the number as input,
sweets = {1: ['1 Snickers Ice Cream Bar', 100], 2: ['2 Nutter Butters', 200], 3: ['3 Twix', 300], 4: ['4 Twizzlers', 400], 5: ['5 Ice Cream Sandwich', 500] } print('We have these very fattening choccy bars to help you put on weight, you fat lump or enter q ... ') for key in sweets.keys(): print(sweets[key][0]) calories = 0 mychoices = [] while True: print('Enter q to quit and show result.') choice = input('Choose a choccy number from the list above you fat slob ... ') if str(choice) == 'q': break mychoices.append(int(sweets[int(choice)][1])) for c in mychoices: calories += c print(f"calories = {calories}")