I want to remove a value from a list if it exists in the list (which it may not).
a = [1, 2, 3, 4] b = a.index(6) del a[b] print(a)
The abov
Usually Python will throw an Exception if you tell it to do something it can't so you'll have to do either:
if c in a: a.remove(c)
or:
try: a.remove(c) except ValueError: pass
An Exception isn't necessarily a bad thing as long as it's one you're expecting and handle properly.