Find longest string in a list
<p>I need to write a code where a function takes in a list and then returns the longest string from that list.</p>

<p>So far I have:</p>

<pre><code>def longestword(alist):     
    a = 0     
    answer = '' 
    for i in alist:         
        x = i     
    if x &gt; a:         
        a = x         
        answer = x     
    elif i == a:         
        if i not in alist:             
            answer = answer + ' ' + i     
    return answer
</code></pre>

<p>The example I have is <code>longestword([11.22,"hello",20000,"Thanksgiving!",True])</code>
which is supposed to return <code>'Thanksgiving!'</code> but my function always returns <code>True</code>.</p>