Python3 / 간단한 자판기 Simple Banding Machine

Geewon Kim·2024년 1월 17일

Python

목록 보기
2/7
quantity = 3
coffee_price = 300

'''
print("커피가 나옵니다.\t거스름돈은 {0}원입니다.".format(money-coffee_price))
        quantity -= 1
    else:
'''

while quantity > 0:
    money = int(input("돈을 넣어주세요: "))
    if money < 300:
        while True:
            #print(money)
            add_money = int(input("현재금액 : {0}\n금액을 {1}원 더 넣으세요: ".format(money, 300-money)))
            money += add_money
            #        print("현재 금액 {0}원을 반환합니다.".format(money))
            #money = 0
            if money >= 300:
                print("커피가 나옵니다.\t거스름돈은 {0}원입니다.".format(money-coffee_price))
                quantity -= 1
                break

    else: 
        print("커피가 나옵니다.\t거스름돈은 {0}원입니다.".format(money-coffee_price))
        quantity -= 1
print("자판기를 폐쇄합니다.")
profile
내 지식의 외장하드

0개의 댓글