saving . . . saved find second occurence has been deleted. find second occurence has been hidden .
find second occurence
Title
Question
list=[2,3,2,4,5,6]
how to delete second occurrence of any number in list 

Python-3.4.3 Getting-started-with-Lists 00-01 min 0-10 sec 22-06-19, 5:15 p.m. Nigam.1611

Answers:

You can use the following code;

num = 2
occur = 0
for ix, elem in enumerate(list1):
    if elem == num:
        if occur == 0:
            occur += 1
        else:
            list1.pop(ix)

18-04-20, 9:20 p.m. ankitrj.iitb


Log-in to answer to this question.