+ 1
based on letters.remove() syntax
when this code is run only 1st 'p' is removed what should be done to remove 4th 'p' and not the 1st. letters= ['p', 'q', 'r', 'p', 's', 't'] letters.remove('p') print(letters)
1 Respuesta
+ 4
This should remove the second occurance of a letter:
letters= ['p', 'q', 'r', 'p', 's', 't']
print(letters)
del letters[letters.index('p',1)]
print(letters)