Thursday, 12 September 2013

TypeError: 'list' object is not callable

TypeError: 'list' object is not callable

I can't find the problem im facing this exactly what the error tells me:
"File "C:/Users/Rodrigo Villalta/Desktop/listasparimpar.py", line 38, in
listas_par_impar if lista2(m) > lista2 [m+1]: TypeError: 'list' object is
not callable"
def listas_par_impar(lista,lista2):
lista3=[]
lista4=[]
for i in lista2:
if i % 2 == 0:
lista=lista+[i]
else:
pass
for i in lista:
if i %2 != 0:
lista2=lista2+[i]
else:
pass
for i in lista:
if i%2==0:
if i not in lista3:
lista3=lista3+[i]
lista=lista[1:]
for i in lista2:
if i%2!=0:
if i not in lista4:
lista4=lista4+[i]
lista=lista[1:]
for recorrido in range(1,len(lista)):
for posicion in range(len(lista)-recorrido):
if lista(posicion) > lista [posicion+1]:
lista[posicion], lista[posicion+1] = lista[posicion+1],
lista[posicion]
for r in range(1,len(lista2)):
for m in range(len(lista2)-r):
if lista2(m) > lista2 [m+1]:
lista2[m], lista2[m+1] = lista2[m+1], lista2[m]
print (lista4, lista3)

No comments:

Post a Comment