Dies ist das Programm, das ich geschrieben habe, aber ich kann kein Bankprogramm machen, das def
Funktionen wie def withdrawl (current_amount, withdrawl_amount)
verwendet. und verwendet if
, elif
und else
für die Optionsliste. Bitte helfen Sie.Wie macht man ein Bankprogramm mit Def-Funktionen, kehrt zurück und wenn elif sonst?
balance = 2000
rt = 0.01
years = 0
while True:
print('===============================')
print(' Welcome to STEVENS UNIVERSAL BANK ')
print('Please Choose an Option')
print('Option 1: Withdrawl')
print('Option 2: Deposit')
print('Option 3: Check_Balance')
print('Option 4: Balance with Updated Interest')
print('Option 5: Exit')
print('===============================')
option = int(input('Choose an Option:'))
years = years + 1
if option == 1:
withdrawl = int(input('How much do you want to Withdrawl?:'))
balance = balance - withdrawl
print (' New Balance :', balance)
elif option == 2:
deposit = int(input('How much do you want to Deposit?:'))
balance = balance + deposit
print (' New Balance:', balance)
elif option == 3:
print('Balance:', balance)
elif option == 4:
balance = balance * (1 + (0.0001 * years))
print (' Updated Balance', balance)
elif option == 5:
print (' Thank you for using THE STEVENS UNIVERSAL BANK ')
exit()
else:
print('Invalid Input')