Python - When trying to run the code nothing happens. I don't even get an error
<p>I am trying to create a small betting application with Python and when I try to run the program nothing happens what so ever. I am using IDLE.
This is my code:</p>

<pre><code>def bet():
    #balance = 100
    x = 0
    with open("bal.txt", "r") as f:
        for l in f:
            bal = (sum([int(a) for a in l.split()]))
            while bal &gt; 0:
                print ("Your balance is: " + str(balance) + " credits.")
                while x == 0:
                    print ("Enter the amount you would like to bet:")
                    bet = int(input())
                    if bet &gt; bal:
                        x = 0
                    elif bet &lt; 0:
                        x = 0
                    else:
                        x = 1
                print ("Pick a number between 1 and 20")
                num = int(input())

                convbal = bal - bet
                print ("Your bet is now locked in...")
                print (" ")
                print (" ")

                import random
                rannum = random.randint(1, 20)
                print ("Your guess was: " + str(num))
                print (" ")
                print ("The random number was: " + str(rannum))

                if rannum == num:
                    print ("WINNER")
                    bal = bal + (bet * 2)
                else:
                    print ("LOSER")
                    print ("")
                    print ("")
</code></pre>

<p>This is the outcome I receive in shell:</p>

<p><a href="http://i.stack.imgur.com/z2gO7.png" rel="nofollow"><img src="http://i.stack.imgur.com/z2gO7.png" alt="output"></a></p>

<p>Any idea will be great, thanks :)</p>

<p>The ONLY thing that code does is define a function named <code>bet</code>.  You could type <code>bet()</code> in the IDLE shell to call it, or put <code>bet()</code> at the bottom of the file (not indented!) to call it automatically.</p>

python python-idle