alphacentauri
alphacentauri

Reputation: 1020

Difficulty in understanding the error in python

I wrote a piece of code in python that reads a string, split it into 2 parts,the first being a string again and the second being an integer. For example

ABDKEK 1255443

The code is as follows:

   L=raw_input()
   ls=L.split()
   num=int(ls[1])
   L=ls[0]
   len=len(L)

and it gives the following error

     len=len(L) 
TypeError: 'int' object is not callable

I make the following change in the code:

 length=len(L)

and it works.

Can anyone explain what does the error 'int' object is not callable mean??

Upvotes: 0

Views: 56

Answers (1)

doptimusprime
doptimusprime

Reputation: 9395

len is a function name which is already defined and should not be use as a variable. Try some other name instead.

Upvotes: 4

Related Questions