How to successfully implement my own __contains__ method for an ArrayList class?
<p>I'm a relatively new python programmer and am trying to fix my <strong>contains</strong> method in my ArrayList class. I want to check if an input value is actually contained in the stored list.</p>

<pre><code>def __contains__(self, value):
        """Implements `val in self`. Returns true if value is found in this list."""
        for num in iter(self):
            if(num==value):
                return True
            else: 
                return False
</code></pre>

<p>Could someone tell me what might be wrong with this code? I test it with a generated list range(100) for the value 50 but it won't return True.</p>