Computer Science, asked by debrajmondal04, 10 months ago

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 abhisheak991
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