title: How can I check if an if statement inside a while loop has been satisfied?
body: <p>I'm trying to make a program that, when given the terms of a sequence, prints an polynomial equation that can get those terms. I've added another feature to it, which mirrors the first part, in that it gives you the terms of the sequence after entering the equation.</p>
  
  <p>So far, that has gone mostly well, but I've come across a problem when trying to implement another feature. If the user has already gotten the equation to a sequence, and they'd like to check perhaps some more terms of that sequence, I want them to be able to copy that equation if they'd like to, without doing it by hand, if that makes sense.</p>
  
  <p>My attempt at this is as follows:</p>
  
  <pre><code>def func(var):
      if str(var) == "solve":
          terms = input("terms: ").split()
  
          ...
          coefs = []
          # code that defines the list coefs
          ...
  
          coefs = [a,b,c...]
  
          print(", ".join(coefs))
  
          copyeq = 1
  
      elif str(var) == "check":
  
          try:
              if copyeq == 1:
                  if input("use coefficients as above?: ") == "yes":
                      checklist = coefs
  
                  else:
                      return
  
              elif copyeq == 0:
                  checklist = input("input coefficients: ").split()
  
              ...
              terms = []
              # code that defines the list terms
              ...
  
              terms = [p, q, r...]
              print(", ".join(term))
  
  copyeq = 0
  
  while 1:
      var = input("solve or check: ")
      func(var)
  </code></pre>
  
  <p>When I try to test this, it immediately jumps to the <code>elif copyeq == 0:</code> statement, meaning the value of 0 that I assigned to it in the <code>if var == "solve":</code> statement. Does anyone have any workarounds or solutions?</p>
  
  <p>Edit: I intend for the user to be able to solve a sequence for its equation, or to check an equation for its sequence. If they choose to solve a sequence first, I want them to be able to check the equation that they just got as an answer. I thought that pointers could potentially solve my problem, but a quick search informed me that Python doesn't have pointers.</p>