while True :
print("--- metro ---")
station = int(input("이동할 정거장 수를 입력하세요. :"))
fee = 0
if station >=1 and station <= 5 :
fee = 500
elif station > 5 and station <= 10 :
fee = 600
elif station > 10 :
fee = 600
add = station - 10 # 초과된 정거장 수
# 검사 : add가 홀수인가?
if add % 2 == 1 :
add += 1
addfee = add // 2 * 50
fee += addfee
print("요금은 %d 원 입니다." % fee)
# 보유현금 입력
money = int(input("보유현금 입력 : "))
if money >= fee :
print("잔액은 %d 원 입니다." % (money - fee))
print("안녕히가세요~")
else :
print("현금이 부족합니다.")
print("-----------")
댓글