Longest strings from list
<p>I was making a function that returns the longest string value from a list. My code works when there is only one string with the most characters. I tried to make it print all of the longest strings if there were more than one, and I do not want them to be repeated. When I run this, it only returns 'hello', while I want it to return 'ohman' and 'yoloo' also. I feel like the problem is in the line <code>if item not list:</code>, but I have tried everything and it doesn't work.</p>

<pre><code>list = ['hi', 'hello', 'hey','ohman', 'yoloo', 'hello']
def length(lists):
    a = 0 
    answer = ''
    for item in lists:
        x = len(item) 
    if x &gt; a:
        a = x
        answer = item
    elif x == a:
        if item not in list:
            answer = answer + ' ' + item
    return answer
print length(list)
</code></pre>
