yes or no loop (TypeError: 'NoneType' object is not iterable) error
<p>I'm trying to implement a yes / no / retry, but I am getting this error:  'NoneType' object is not iterable. I assume the issue is the function (def izberiEkipo() is not returning what it's suppose to.</p>

<pre><code>def izberiEkipo():

    m  = set(['m'])
    p = set(['p'])


    while False:
        if reply in m:
            with open('vprasanja2.txt') as f:
                vsaVprasanja = [line.strip() for line in f]
                max_line = len(vsaVprasanja)
            True


        elif reply in p:
            with open('vprasanja.txt') as f:
                vsaVprasanja = [line.strip() for line in f]
                max_line = len(vsaVprasanja)
            True

        else:

            sys.stdout.write("Answer with 'm' ord 'p'")


        return (max_line, vsaVprasanja)  

def genVprasanja ():

    obsVred = set()
    maxL, vsaQ = izberiEkipo()
    tocke = 5
    total = 0
       .
       .
     [...]
</code></pre>

<p>Your assumption is correct: as given, your upper function returns nothing.  You've disabled the loop with a <strong>False</strong> entry condition: it won't run at all.  The only <strong>return</strong> in the function is inside that loop.</p>

<p>Thus, all that routine does is to create two sets of a single character each, and then return <strong>None</strong> to the main program.  Since you haven't included code to reproduce the problem -- in fact, the line that throws the error isn't in your example -- and no trace-back, we can't help much farther than this.</p>

python