-1
これは私が書いたプログラムですが、def
のような機能を使用する銀行プログラムをdef withdrawl (current_amount, withdrawl_amount)
のように作ることはできません。オプション一覧にはif
,elif
、else
を使用します。助けてください。def関数を使用して銀行プログラムを作成する方法、返却する方法、elif else?
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')