使用while循环运行以下代码时出现语法错误

时间:2020-05-07 22:32:17

标签: python while-loop

当我使用while循环运行以下代码时,出现语法错误。可能是什么原因?谢谢。

original_balance = float(input("Enter the outstanding balance on your credit card: "))
annual_interest_rate=float(input("Enter the annual credit card interest rate as a decimal: "))
Min_monthly_payment_rate=float(input("Enter the minimum monthly payment rate as a decimal: "))

a=1

while a < 12


    Min_monthly_pay=(Min_monthly_payment_rate*original_balance)

    Interest_paid=(annual_interest_rate/12*original_balance)

    Principal_paid=(Min_monthly_pay-Interest_paid)

    original_balance=original_balance-Principal_paid

    print(original_balance)

    a=a+1

1 个答案:

答案 0 :(得分:0)

while语句后需要一个:(冒号)。

while a < 12: