save money or withdraw money
# withdraw money
print("welcome to this bank")
set_Account = input("please input your name to create your account")
set_Password = eval(input("please input your eight numbers set your password"))
set_Account_successful = set_Account
set_Password_successful = set_Password
credit_Money = 0
# create your account
user_error_count = 3
for i in range(user_error_count):
user_Account = input("please input your name to use your account")
user_Password = eval(input("please input your password to unlock your account"))
if user_Account == set_Account_successful and user_Password == set_Password_successful:
print("congratulation,now this your account:%s" % set_Account_successful)
break
else:
user_error_count -= 1
print("now you have %d" % user_error_count)
if user_error_count == 0:
print("This account is locked")
print("now you have %d dollar.Would you want to save or withdraw money?" % credit_Money)
# How much money do you have?
in_Account = True
save_Money_str = 'save money'
withdraw_Money_str = 'withdraw money'
judgement_Action = input("Do you want to action")
while in_Account:
if judgement_Action == save_Money_str:
save_Money = int(input("How much money you are going to save!"))
credit_Money += save_Money
print("you have %d dollar" % credit_Money)
elif judgement_Action == withdraw_Money_str:
withdraw_Money = int(input("How much money you are going to withdraw!"))
credit_Money -= withdraw_Money
print("you have %d dollar" % credit_Money)
if credit_Money - withdraw_Money <= 1:
print("sorry,you don't have money to withdraw")
break
judgement_Action = input("Do you want to action")
print("Good bye")
Thanks for watching.