bingo number check
<p>So I build a tiny bingo program for my wife to use at her candle parties.  The boards are already generated.  This is just a program to call out the numbers.</p>

<pre><code>import random
a = []
a = list(range(1,76))
random.shuffle(a)

def pop(x):
    while 1:
        b = a.pop(0)
        if b &lt;= 15:
            print 'b', b,
        elif b &gt; 15 and b &lt;=30:
            print 'i', b,
        elif b &gt; 30 and b &lt;=45:
            print 'n', b,
        elif b &gt; 45 and b &lt;=60:
            print 'g', b,
        else:
            print 'o', b,
        raw_input('')

pop(1)
</code></pre>

<p>Now her parties are getting larger and she is worried about someone cheating so I would like to add in a feature where I could type in the numbers that supposedly won and have the program let me know if those numbers where indeed called.  I have tried running it to a file with</p>

<pre><code>def pop(x):
    while 1:
        b = a.pop(0)
        with open('bingo.txt', 'w') as file1:
            file1.write(b,'\n')
        if b ...
</code></pre>

<p>but it just opens and then closes back down. No errors or any text to the file.  It doesn't need to go to a file.  I just thought that if it did, I could then add in a searchfile feature at the end and know whether the number was called or not.
What would be the best way to find out if the numbers on the "winning" line were actually called?    </p>
