Define a Python function remdup(l) that takes a nonempty list of integers l and removes all duplicates in l, keeping only the first occurrence of each number
Answers
Answered by
0
Answer:
for nptel 3
Explanation:
def remdup(l):
l.reverse()
c1=len(l)
c=0
for a in l:
c=c+1
l2=l[c:c1]
l2.reverse()
for b in l2:
if a==b:
l.reverse()
i=l.index(a)
del l[i]
l.reverse()
l.reverse()
return(l)
Similar questions
Computer Science,
5 months ago
Physics,
5 months ago
Math,
5 months ago
Social Sciences,
10 months ago