黑馬程序員python教程,8天python從入門到精通,學python看這套就

p61代碼:
name = input("請輸入您的姓名:")
momey = 5000000
def menu():
print("----------------主菜單------------------\n"
"周杰倫,您好,歡迎來到黑馬銀行ATM,請選擇操作:\n"
"查詢余額 [輸入1]\n"
"存款 [輸入2]\n"
"取款 [輸入3]\n"
"退出 [輸入4]\n"
"請輸入您的選擇\n")
global a
a = int(input())
if a == 1:
lose()
elif a == 2:
inmom()
elif a == 3:
outmom()
else:
exit()
def lose():
print(f"當前余額為{momey}")
menu()
def inmom():
mom = int(input("請輸入存款金額:"))
global momey
momey += mom
print(f"當前余額為{momey}")
menu()
def outmom():
mom = int(input("請輸入取款金額:"))
global momey
momey -= mom
print(f"當前余額為{momey}")
menu()
menu()
標簽: