I am trying to use 3 tuples which represent the price of three different types of bonus, so, when choosing any type of them, the quantity of the type of bonus to be purchased must be specified and it must automatically calculate the total amount to be paid for the chosen amount. It can be done with the two types of basic bonuses, but when doing the calculation with the premium bonus it gives me an error: argument of type 'float' is not iterable, any ideas to solve it?
basic_bonus_1 = (0.01, 0.02, 0.03)
basic_bonus_2 = (0.04, 0.05, 0.06)
premium_bonus = (1.99)
while True:
price_bonus = input("\nEnter the price of bonus (or quit): ")
if price_bonus == 'quit':
break
price_bonus = float(price_bonus)
quantity = int(input("\nEnter the quantity of bonus: "))
if price_bonus in basic_bonus_1:
total = price_bonus * quantity
print("Bono elegido: 1, precio a pagar:", total)
elif price_bonus in basic_bonus_2:
total = price_bonus * quantity
print("Bono elegido: 2, precio a pagar:", total)
elif price_bonus in premium_bonus:
total = price_bonus * quantity
print("Bono elegido: premium, precio a pagar:", total)
else:
print("Sorry, this value is not valid!!!")