2番目のループは機能しません。私はそれが出力に任意のテキストをdoesntのコンパイルすると、それだけの入力を要求し、そこ2番目のループがうまくいかない理由
を停止それはちょうど最初の1、第2のループありえないが実行されていることを意味しますが、私は、なぜ
balance0 = float(input("balance = "))
annualInterestRate = float(input("annualInterestRate = "))
monthlyPayment = 10
balance = 0
month = 1
while (0):
balance = balance0
while month <= 12:
balance1= (balance + annualInterestRate * balance/12)
balance1 = balance1 - (monthlyPayment)
print("Remaining balance month " , month, " is ", balance1)
balance = balance1
month += 1
if balance < 0:
print("Lowest payment: ", monthlyPayment)
break
else:
monthlyPayment += 10
ループを知りません
while month <= 12
実行するのはなぜですか?
あなたは 'while(0)'という条件を持っているので、 'while False'に変換されます。これは決して以下のステートメントを入力することを許可しません。あなたは、代わりに、 'balance!= 0'なのか、それとも何かを望んでいないのですか? – blacksite
while(0) 'は決して真ではないため、実行されません。 – Cleb
あなたが私に尋ねると両方のループのようには見えない – RSon1234