0
此代碼產生錯誤:是什麼原因造成「類型錯誤:不串中轉換的所有參數格式」
# -*- coding: utf-8 -*-
amount = float(input("Enter the purchase price please."))
down_payment=amount *0.10
monthly_rate = (amount - down_payment) *.05
ending_balance=amount-down_payment
print("|Ø-6s|Ø-16s|Ø-9s|Ø-8s|Ø-14s|" % ("Month" , "Current Balance" , "Interest" , "Payment" , "Ending Balance"))
month = 1
while True:
starting_balance = ending_balance
interest = starting_balance * 0.01
final_amount = (starting_balance+interest)
if monthly_rate > final_amount:
monthly_rate = final_amount
ending_balance = final_amount - monthly_rate
print("|Ø-6f|Ø-16f|Ø-9f|Ø-8f|Ø-14f|" % (month , starting_balance , interest , monthly_rate , ending_balance))
month+=1
if ending_balance <= 0:
break
錯誤:
<module>
print("|Ø-6s|Ø-16s|Ø-9s|Ø-8s|Ø-14s|" % ("Month" , "Current Balance" , "Interest" , "Payment" , "Ending Balance"))
TypeError: not all arguments converted during string formatting
你不提供格式說明您的任何值,所以沒有價值的使用,使他們所有遺留下來的。 – kindall