I have a question in the following code in python: why doesn't it give the same result when creating the list by comprehension and the list in a normal way?
lista = ['hola', 'mundo', 'hola', 13, 14]
#LISTA POR COMPRENSIÓN
lista1 = []
lista1 = [ (i, lista.count(i)) for i in lista if ((i, lista.count(i)) not in lista1)]
print('Lista: ', lista1)
#LISTA DE FORMA NORMAL
lista2 = []
for x in lista:
if(x, lista.count(x)) not in lista2:
lista2.append( (x, lista.count(x)) )
print('Lista: ', lista2)