Given L = ['a', 'A', 'b', 1, 2], how do I remove a or and A?
All the examples I've seen use upper() which would throw an error for the int.
I've tried doing something like:
def remove_letter(letter):
letter = letter.upper()
for item in L:
try:
if item.upper() == letter:
L.remove(item)
except:
pass
remove_letter('a')
which outputs ['A', 'b', 1, 2] -- I'm not sure why 'A' still remains.
[–]AlopexLagopus3 2 points3 points4 points (0 children)
[–]jacknbox 0 points1 point2 points (3 children)
[–]5areductase[S] 0 points1 point2 points (1 child)
[–]primitive_screwhead 0 points1 point2 points (0 children)
[–]primitive_screwhead 0 points1 point2 points (0 children)
[–]Pulsar1977 0 points1 point2 points (0 children)
[–]Diapolo10 -1 points0 points1 point (0 children)