condensing multiple if statements in python
<p>I'm trying to write a function to check if an object is found in multiple lists and to remove the object from any list its found in. I want to know if there is a way to make it cleaner or smarter using some form of generic variable where you predefine the format or something along those lines. 
my code in its ugly form:</p>

<pre><code>def create_newlist(choice):

    if choice in list_a:
        list_a.remove(choice)
    if choice in list_b:
        list_b.remove(choice)
    if choice in list_c:
        list_c.remove(choice)
    if choice in list_d:
        list_d.remove(choice)
    if choice in list_e:
        list_e.remove(choice)
</code></pre>

<p>What I'm hoping for is something like:</p>

<pre><code>if choice in list_x:
   list_x.remove(choice)
</code></pre>

<p>I would like it to work for each list, would I need to loop through? any suggestions would be great! I have the workaround but I would love to learn a more elegant way of coding this!</p>

<p>An alternative to the former suggestions, which is a bit clearer, is to define a helper function. So, instead of:</p>

<pre><code>def create_newlist(choice):

    if choice in list_a:
        list_a.remove(choice)
    if choice in list_b:
        list_b.remove(choice)
    if choice in list_c:
        list_c.remove(choice)
    if choice in list_d:
        list_d.remove(choice)
    if choice in list_e:
        list_e.remove(choice)
</code></pre>

<p>You'd have:</p>

<pre><code>def create_newlist(_list, choice):
    if choice in _list:
        _list.remove(choice)

lists = [list_a, list_b, list_c, list_d, list_e]

for _lst in lists:
    create_newlist(_lst, choice)
</code></pre>

python list loops if-statement