title: Undoing a function while requirements met
body: <p>What I'm trying to do is Take Food from  Variable "FGlasgow" and add it to Variable "Food", Nice and simple, But i noticed that even when FGlasgow became negative the script would still take more, So I told the script if Glasgow &lt; 0 to add the food back and take a random number, The question is whether this can be shortened at all, and if my method is correct.</p>
  
  <pre><code>import random
  
  def RandomNo():
      Random = random.randint(0,50)
      return Random
  
  Food = 1
  FGlasgow = 100
  
  
  while True:
      Random = RandomNo()
      Food += Random
      FGlasgow -= Random
      while FGlasgow &lt; 0:
          Food -= Random
          FGlasgow += Random
          Random = RandomNo()
          Food += Random
          FGlasgow -= Random
      print "You have found" , Random , "units of food"
  </code></pre>
  
  <p>Thank you for the help:) Any suggestions would be great:)</p>