Having trouble with python simple code running in console [closed]

There were multiple errors and indentation problem ;I commented them where you made mistakes:

p = int(raw_input("Please enter deposit amount: \n"))
r = int(raw_input("Please input interest rate: \n")) #rename i to r
t = int(raw_input("Please insert number of years of the investment: \n"))
interest = raw_input("Do you want a simple or compound interest ? \n")

A = p*(1+r*t) #multiply p with ()
B = p*(1+r)**t #same as B

 #** is power

if interest == "simple":
    print (float(A)) # you dont need to cast the float again to int
else: #since there is no other conditions it's obvious to print compound 
    print(float(B))# you dont need to cast the float again to int

Leave a Comment