Search code examples
cpython

"unsupported operand type(s) for /: 'list' and 'list'" in cpython


I am totally new to programming. You can say illiterate in respect of coding. I am trying to learn cpython with the version 3.4 interpreter. I am getting an error

"unsupported operand type(s) for /: 'list' and 'list'" 

in following code:

sl = input("Please enter Loan amount :-  ")
si = input("Please enter desired interest rate (in decimal point) :-  ")
sn = input("Please enter number of installments :-  ")
L=float(sl)
I=float(si)
N=float(sn)

EMI = [L * I * (1+I) * N] / [((1+I) * N)-1]
print(EMI)

Solution

  • In Python,lists are defined by square braces (similar to arrays in C). In the expression EMI = [L * I * (1+I) * N] / [((1+I) * N)-1] you are trying to divide two lists. Replacing them with normal round brackets may eliminate the problem.