Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def available_products_cash(banknotes_check, vending_machine, money):
- print("available_products_cash.money =", money)
- if money == 0:
- print("You haven't inserted a banknote. Try again")
- else:
- items = []
- for item in range(len(vending_machine[PRICE])):
- if money >= vending_machine[PRICE][item] and vending_machine[QUANTITY][item] > 0:
- print(f"Number of {vending_machine[NAME][item]} is {item}")
- items.append(item)
- choice = int(input("Please, input the number of chosen product: "))
- for i in items:
- if choice in items:
- print(vending_machine[NAME][choice], vending_machine[PRICE][choice], vending_machine[QUANTITY][choice],
- end=' ')
- print()
- vending_machine[QUANTITY][choice] -= 1
- money -= vending_machine[PRICE][choice]
- break
- else:
- print("You don't have enough money. Try to insert more money or buy another product.")
- break
- return banknotes_check, vending_machine, money
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement