title: Running a loop on preset conditions in python
body: <p>I created a class to solve maths problems of the sort a<em>b-c. However, I want function only to run if a</em>b-c is in range (0,100). When I run my code, it just continues to print "out of range". Instead, I would like it to try a*b-c until the result falls in the desired range (i.e., between 0 and 100). Any suggestions will be greatly appreciated!</p>
  
  <pre><code>#MULTIPLIZIEREN
  
  class Multiplizieren:
      def __init__(self,name):
      self.name = name
      self.a = rdm.randint(5,20)
      self.b = rdm.randint(4,50)
      self.c = rdm.randint(2,200)
  
  def punktstrich(self):
      finished = False
      while not finished:
          c = self.a*self.b-self.c
          if c &lt; 0 or c &gt; 100:
              print('OUT OF RANGE')
              return
          else:
              print(self.a, '*', self.b, '-', self.c, '=', self.a*self.b-self.c)
              finished = True
              return c
  </code></pre>