Basic decrement loop - PYTHON
<p>Newbie to python and hit a snag in my latest program. Simply put, I'm trying to code up a decrement loop for a user input variable if possible. Essentially I have a global constant set to value e.g. 13, each time the program loops it prompts the user to input a value then that user value is shaved off 13 until it reaches 0. Problem is that it does shave it off but when it reiterates it resets the value to 13 and only removes the current iterate value entered. So if you enter 2 each iteration it just takes it down to 11... But I'm aiming for a result using 2 as an example again, 11, 8, 5, etc etc or using 3 as an example 10, 7, 4.... Any help guys will be much appreciated, cheers :)</p>

<pre><code>a = 13

def main():
    runLoop()

def runLoop():
    while other_input_var &gt; 0: # guys this is my main score accumulator
                               # variable and works fine just the one below
        b=int(input('Please enter a number to remove from 13: '))
        if b != 0:
            shave(a, b)

def shave(a, b):
    a -= b
    print 'score is %d ' % a
    if a == 0:
        print "Win"

main()
</code></pre>
