python, list compare, ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
<p>Here is my python code:</p>

<pre><code>def ava_check(nodes_group,child_list):
    ava_list=nodes_group[:]

    if nodes_group[1] in child_list:
        return None
    else:
        for a in nodes_group:
            if a in child_list:
                ava_list.remove(a)
                ava_list.remove(nodes_group[nodes_group.index(a)-1])
            else:
                pass
</code></pre>

<p>The <code>nodes_group</code> is a list like <code>[0.0, (0, 3), 0.0, (0, 2), 0.0, (1, 3)]</code>.
The <code>child_list</code> is a list like <code>[(0, 1)]</code>.</p>

<p>But when I run the code, there is an error: <code>ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()</code> happened in line <code>if a in child_list:</code>. I have no idea what is the problem here. I tried to search, but they said something about numpy. But I didn't use numpy here, the two inout arguments are just list with tuples. </p>

<p>Could you help me with this problem?</p>

<p>Thanks very much.</p>

<p>UPDATE: Thanks for everyone's solution. Some data (not tuples) in the list nodes_group are from the <code>numpy</code> array. But I store the data in new list. So I checked the data type of the element in the new list using type(), and I found that the type is <code>numpy.float64</code>, which explains why I have this error. So I write a loop to change the type of element in list from <code>numpy.float64</code> to int by just using <code>int()</code>. So the problem is solved. But anyone know whether is a better solution or more pythonic way? Thanks.</p>