Need help! A syntax error in my python school project?

Rate=float(input("The rate of interest is "))
Loan=float(input(“The amount of loan is RM”))
print(“Press F for flat interest”)
print(“Press O for interest on balance”)
Type=str(input("The type of loan interest is "))

if (Type==“F” or Type==“f”):
Years=float(input("The loan period by years is "))
Total_payment=Loan+(LoanRateYears)
Flat_monthy_payment=Total_payment/(Years*12)
Flat_monthly_payment=round(Flat_monthly_payment,2)
print(“The Monthly instalment is RM”,(Flat_monthly_payment)

elif (Type==“O” or Type==“o”):
Months=int(input("The loan period by months is "))
Monthly_installment=float(input(“The monthly installment is RM”))
No_Month=0
for x in range (Months):
Current_monthly_payment=payment_with interest-Monthly_installment
Finance_Charge=Loan*Rate/12
Payment_with_interest=Loan+Finance_Charge
Loan=Current_monthly_payment
Current_monthly_payment=round(Current_monthly_payment,2)
temp=No_month
temp=temp+1
No_month=temp
print(No_month,“month is RM”,Current_monthly_payment)

else:
print(“error!”)

Hello, @albertwek. Welcome to the forum.

Code that is posted without the indentations preserved, is not Python. Indentations are not optional in Python, but are rather an essential part of the language , lacking which your code will not run at all.

Unindented code is difficult to read, requires guesswork concerning your intent, and cannot be copied and pasted for testing, both because it is unindented and because it often contains characters such as left-and right double-quotes that are unreadable to the Python interpreter.

The Codecademy forum provides a quick and easy way to post properly-formatted code. All you need to do is look for the </> icon in the menu bar which appears at the top of the text box while you type.

capture

Press Enter to go to a blank line, click that icon, and you will see this:

capture_r

Just copy and paste your code directly from the editor into that highlighted portion, and all of the nicely-readable Python formatting will be preserved! Moreover, it will be in a format that can be directly copied and pasted into a Python IDE for testing.

The same icon can be used for highlighting small code snippets in-line for clarity.

1 Like