此代码产生错误:
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
错误:
# -*- 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
答案 0 :(得分:0)
您必须在格式化字符串中使用%
而不是Ø
。
print("|%-6s|%-16s|%-9s|%-8s|%-14s|" % ("Month" , "Current Balance" , "Interest" , "Payment" , "Ending Balance"))
和
print("|%-6f|%-16f|%-9f|%-8f|%-14f|" % (month , starting_balance , interest , monthly_rate , ending_balance))