meg
meg

Reputation: 73

I keep getting an error on Python, TypeError: unsupported operand type(s) for /: 'tuple' and 'int' What am I doing wrong?

Compound Interest Calculator

#Input

P = (float, input("Enter the starting principal: ") )
R = (float, input("Enter the annual interest rate: ") )
m = (int, input("How many times per year is the interest compounded? ") )
t = (float, input("For how many years will the account earn interest? ") )

#Calculate

#FV = P * ( 1 + ( (R/100) / m ) ) ** ( m * t)

FV = P * ( 1 + ( (R/100) / m ) ) ** ( m * t)

#Output

print("At the end of ", t, "years. You will have $", format(FV, ",.2f") ) 

Upvotes: 0

Views: 64

Answers (2)

Yeetzzzz
Yeetzzzz

Reputation: 1

P = float(input("Enter the starting principal: ") )
R = float(input("Enter the annual interest rate: ") )
m = int(input("How many times per year is the interest compounded? ") ) )
t = float(input("For how many years will the account earn interest? ") )

FV = P * ( 1 + ( (R/100) / m ) ) ** ( m * t)

print("At the end of ", t, "years. You will have $", format(FV, ",.2f") )

The float, input("bla bla bla")) should be like float(input("bla bla bla"))) and with int, input("bla bla bla")) change it to this: int(input("bla bla bla"))

Upvotes: 0

Python learner
Python learner

Reputation: 1145

Correct syntax:

input_variable = float(input("some text"))
input_variable= int(input("some text"))

Upvotes: 1

Related Questions