Notice
Recent Posts
Recent Comments
Link
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Tags
more
Archives
Today
Total
관리 메뉴

PythonHolic

[python] 어버이날 선물 목표 금액 채우기 본문

파이썬 과제 도와주기 일지

[python] 어버이날 선물 목표 금액 채우기

devpy 2020. 6. 25. 15:43

 

total = 0
while True:
    who=input('어버이날 선물을 위하여 저축하는 사람은? (I/bro): ')
    money=int(input('저축하는 액수를 입력하세요: '))
    
    if who == 'I' or who == 'i':
        print('내가', money, '원 저축합니다!')
        total += money       
    else:
        print('동생이', money, '원 저축합니다!')
        total += money
    print('현재까지 모은 액수는', total, '원입니다.')

    if total < 100000:
        continue
    elif total >= 100000:
        print("축하합니다 ! 목표 금액을 채우셨습니다!")
        break
Comments