Python 7 Levels, L3, Unit 26, Mimic Banking System I

Powered By EmbedPress

Exercise:

import easygui as g
card1_num = "1001"
card1_pwd = "123456"
card1_money = 0
while True:
    card = g.multpasswordbox("Please input card number and pin",title = "Banking System",fields = ("Card Number","PIN"))
    money = 0
    if card == [card1_num,card1_pwd]:
        money = card1_money
        g.msgbox("Login Successfully.",title = "Banking System")
        while True:
            operation = g.buttonbox("Please pick your operation", choices=("Deposit", "Withdraw", "Balance", "Quit"))
            if operation == "Quit":
                break
            elif operation == "Deposit":
                save_money = g.integerbox("Please how much will you deposit:", lowerbound=0, upperbound=1000000)
                money = money + save_money
                g.msgbox("Deposit successfully. Money deposit is " + str(save_money))
            elif operation == "Withdraw":
                get_money = g.integerbox("Please input how much will you withdraw.", lowerbound=0, upperbound=1000000)
                if get_money > money:
                    g.msgbox("Sorry no enough balance. Operation failed.")
                else:
                    money = money - get_money
                    g.msgbox("Withdraw successfully. Money withdrew is " + str(get_money))
            elif operation == "Balance":
                g.msgbox("Your balance is " + str(money))
    else:
        g.msgbox("Login failed. Please re-enter:",title = "Banking System")
        continue

dahan1999

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts