Facing an issue in removing duplicate entries in a list of my python Program -


the below program entering values list , print list again after removing duplicate entries... can please have , let me know error in program?

print ("enter numbers list \n") list = [] n = int(input("")) while n <= 1000:     list.append(n)     n = int(input(""))  m = len(list) in range (0,m-1):     j in range (i+1,m):         if list[i] == list[j]:             list.remove(j)         else:             pass  print (list) 

when run program gives below error:

file "python", line 23, in <module>     valueerror: list.remove(x): x not in list 

as keep deleting elements length of list keeps decreasing , index accessing might not accessible

instead like

list(set(t)) 

and dont name lists "list" keyword


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -