def coffeeMachine(): usrval = input("What would you like? (espresso/latte/cappuccino): ") if usrval in MENU.keys(): coins = COINS.copy() print("Please insert coins: ") for k, v in COINS.items(): val = int(input(f"How many {k}: ")) COINS[k] = val * COINS[k] if sum(COINS.values()) >= MENU[usrval]["cost"]: x = sum(COINS.values()) - MENU[usrval]["cost"] change = round(x, 2) print(f"Here is your ${change} in change.") print(f"Here is you {usrval} Enjoy!") resourceSub(usrval) resourceCheck() if not EMPTY: for k in COINS and coins: COINS[k] = coins[k] coffeeMachine() else: print("Please insert the right amount of money") coffeeMachine() elif usrval == "report": for k, v in resources.items(): print(k, v) coffeeMachine() else: print("Invalid input!")
def menu(ALBUMS): print("MENU") print_dictionary(MENU) option = input("Provide operation number: ") while not option in MENU.keys(): option = input("Provide operation number: ") if option == "1": ALBUMS = import_albums() elif option == "2": display_albums(ALBUMS) elif option == "3": genre = input("Provide genre: ") display_albums(get_albums_by(GENRE_INDEX, genre, ALBUMS)) elif option == "4": year = input("Provide year: ") display_albums(get_albums_by(YEAR_INDEX, year, ALBUMS)) elif option == "5": display_albums(get_youngest_album(ALBUMS)) elif option == "6": display_albums(sort_albums_by_year(ALBUMS)) elif option == "7": time_from = input("Provide time from: (mm:ss)") time_to = input("Provide time to: (mm:ss)") display_albums(get_albums_by_time_range(time_from, time_to, ALBUMS)) else: exit()