ungleich-learning-circle/kjg/python-the-hard-way/e37.py
2020-06-08 22:00:57 +09:00

26 lines
825 B
Python

while 1:
money = input("insert coin=>")
number = input("select beverage\n")
money = int(money)
temp = money
if number == "1":
#grape 100
print("you choose grape. change is ",money-100,"coin")
money = temp-100 #callculate change
if money <= 0: #check money
break
elif number == "2":
#orange 200
print("you choose orange. change is ",money-200,"coin")
money = temp-200 #callculate change
if money <= 0: #check money
break
elif number == "3":
#fanta 300
print("you choose fanta. change is ",money-300,"coin")
money = temp-300 #callculate change
if money <= 0: #check money
break
else:
#wrong sellection
print("wrong number. please select again")