A graphing calculator I wrote a calculator that can solve equations with variables using matplotlib and sympy.
I am looking for tips on performance and style.
How can I improve on this calculator? Is it a good idea to use sympy for this purpose?
Repl.it
import sympy
import matplotlib.pyplot as plt
class Iterator:
  name, equation, val = None, None, None
  def __repr__(self):
    return self.__str__()
  def __init__(self, nameIn, equationIn, valIn):
    self.name, self.equation, self.val = nameIn, equationIn, valIn
  def __str__(self):
    return self.get_name() + &quot;,&quot; + str(self.get_value())
  def iterate(self):
    replaced = self.equation.replace(self.name, str(self.val))
    self.val = sympy.sympify(replaced)
  def get_name(self):
    return self.name
  def get_value(self):
    return self.val
def graph():
  numTimes = input(&quot;How many points &quot;)
  x = input(&quot;What to calculate &quot;)
  points = []
  i = 0
  numInputs = int(input(&quot;How many variables &quot;))
  j = 0
  replaced = []
  iterators = []
  while numInputs &gt; j:
    name = input(&quot;What's the variabe name &quot;)
    iter = input(&quot;What's the iteration equation &quot;)
    val = int(input(&quot;What's the starting value &quot;))
    iterators.append(Iterator(name, iter, val))
    j += 1
  while i &lt; int(numTimes):
    replaced = x.replace(&quot;n&quot;, str(i))
    for j in iterators:
      replaced = replaced.replace(j.get_name(), str(j.get_value()))
      j.iterate()
    final = sympy.sympify(replaced)
    right_type = int(final)
    points.append(right_type)
    i += 1
  plt.plot(points)
  plt.ylabel(input(&quot;What's the y label &quot;))
  plt.show()
while(True):
  command = input(&quot;&gt;&gt; &quot;)
  if command == &quot;graph&quot;:
    graph()
  elif command == &quot;help&quot;:
    print(&quot;&quot;&quot;
    msh.
    Used for graphing.
    Commands:
    graph: an interactive graphing calculator
    help: bring up this message
    quit: exit msh
    &quot;&quot;&quot;)
  elif command == &quot;quit&quot;:
    break
Indentation
You should use four spaces instead of two.
Spacing
Your class methods should be separated by an empty line, so everything doesn't look so crowded.
Getters
Since all class variables are public (except _var and __var variables), you don't need to define getters to access these properties. Simple do Iterator.name, etc.
Iterator.__str__
You should utilize f&quot;&quot; strings to directly include variables in strings.
def __str__(self):
    return f&quot;{self.name},{self.val}&quot;