0
Enter a input list and delete its any one of element which is coming multiple time
2 Respostas
+ 1
You could use the 'is' command as shown below:
b=[1,1,2,3]
if b[1] is b[0]:
print ("Yes")
del b[1]
Probably not the best, but a way to identify if a number repeats.
0
Create a set from the list. Set is a collection of unique objects.
ls = [1,2,1,3,4]
ls = list(set(ls))
print ls
// [1,2,3,4]