본문 바로가기
프로그램

[파이선] 문제 : 제어문 사용해 은행 업무 처리

by 오디세이99 2022. 11. 22.
728x90
반응형

currentMoney = 100000
print('1: Deposit, 2: Withdraw, 3: CheckBalance 4: Exit')
option = int(input('Please Enter Your Choice'))

if option == 1:    # 예금 업무
    money = int(input('입금액을 입력하세요 :'))
    currentMoney += money
    print('잔고는 ',format(currentMoney,','), '입니다')
elif option == 2:  # 출금업무
    money = int(input('출금액을 입력하세요 :'))
    if money > currentMoney:
        print('잔액이 모자랍니다!')
    else:
        currentMoney -= money
        print('잔고는 ',format(currentMoney,','), '입니다')
elif option == 3:  # 잔고 확인
    print('잔고는 ',format(currentMoney,','),' 입니다')
elif option == 4:  # 종료
    print('Thank you for visiting our banl! Good Bye!')
728x90
반응형

댓글