title: Python arithmetic calculator printing incorrect number of dashes
body: <p>I am presently finishing a course in python and I came across this glitch which has stumped me for a few days. The result should resemble this:</p>
  <pre><code>   32      3801      45     123
  + 698    -    2    + 43    + 49    
    ---      ----      --     ---    
    730      3799      88     172  
  </code></pre>
  <p>However, it instead prints out this:</p>
  <pre><code>   32      3801      45     123
  + 698    -    2    + 43    + 49    
    ---      ----      --      --    
    730      3799      88     172  
  </code></pre>
  <p>Please notice the sum of dashes in the fourth equation. In the correct version, the number of dashes correlates to the length of the max number. However, in the incorrect version (my version) the number of dashes is 2 when the length of the max number is 3.</p>
  <p><strong>Here is the entire code</strong></p>
  <pre><code>equations = [&quot;32 + 698&quot;, &quot;3801 - 2&quot;, &quot;45 + 43&quot;, &quot;123 + 49&quot;]
  
  def arithmetic_equation(arr):
  
      stepOne = ''
      stepTwo = ''
      stepThree = ''
      stepFour = ''
  
      finalLine = ''
      anotherLine = ''
      thirdLine = ''
      fourthLine = ''
  
      space = 4
  
      for item in equations:
  
          parts = item.split()
  
          x = parts[0]
          y = parts[2]
          c = parts[1]
  
          if c == '+': z = (int(x) + int(y)) 
          else: z = (int(x) - int(y))
  
          n = len(x) if (x &gt; y) else len(y)
  
  
          stepOne = x.rjust(n + 2)
          stepTwo = c + ' ' + y.rjust(n)
          stepThree = '  ' + '-' * n
          stepFour = str(z).rjust(n + 2)
  
          finalLine += str(stepOne) + ' ' * space
          anotherLine += str(stepTwo) + ' ' * space
          thirdLine += str(stepThree) + ' ' * space    
          fourthLine += stepFour + ' ' * space
  
  
      print(finalLine.rstrip() + '\n' + anotherLine + '\n' + thirdLine + '\n' + fourthLine)
  
  arithmetic_equation(equations)
  </code></pre>