Transaction_Code
== "W"
、"w"
、"D"
または"d"
をしたいのPythonのelifが順番に動作していない私は
ない場合、それは、何が起こっているProcess_Invalid_Code(Previous_Balance)
を実行する必要があります入力ただしTransaction_Code
です!= "W"
、"w"
、"D"
または"d"
、それはその後、"What is your previous balance?"
と"How much is the transaction amount?"
入力を実行し続け...
それは前のバランスとの取引を求めるユーザーの時間を無駄にすることなく、BEFORE Invalid_Transaction_Code ("Invalid Transaction Code!")
などをスローするためだけにして、あなたがそれらのための入力を与えた後、それは私が起こるしたいものInvalid_Transaction_Code
を実行しないこと..です
ん意味がある?
def main():
# never used, lets ask anyway
Name = input("What is your name? ")
# we need this information at a minimum
Previous_Balance = float(input("What is your previous balance? "))
Transaction_Code = input("Press W or w for Withdrawal, Press D or d for Deposit: ")
# if its a withdrawal/deposit, find the amount and account
if Transaction_Code.upper() in "WD":
# we never use this Account_ID ...
Account_ID = input("What is your account ID? ")
Transaction_Amount = float(input("How much is the transaction amount? "))
if Transaction_Code.upper() == "W":
Withdrawal_Process(Previous_Balance, Transaction_Amount)
else:
Deposit_Process(Previous_Balance, Transaction_Amount)
else:
# they've entered a bad code
Process_Invalid_Code(Previous_Balance)
あなたは何を求めていますか?あなたのコードで何が問題になっていますか? – Nicarus
Transaction_Code入力行の直後にmain()に適切な 'if'文を入れておく必要があります。 – jcfollower
また、あなたの人生を楽にし、入力を大文字に変換するために入力を単一のケーシングにキャストします単一のケーシングと比較すると、 'Transaction_Code.lower()==" w "'だけが必要です。または、単に ''( 'w'、 'W')のTransaction_codeを実行してください。 – idjaw