title: The Sum of Consecutive Numbers
body: <p>I have to write a program which asks the user to type in a limit. The program then calculates the sum of consecutive numbers (1 + 2 + 3 + ...) until the sum is at least equal to the limit set by the user.</p>
  <p>In addition to the result it should also print out the calculation performed. I should do this with only a while loop, no lists or True conditionals.</p>
  <pre><code>limit = int(input(&quot;Limit:&quot;))
  base = 0
  num = 0
  calc = &quot; &quot;
  while base &lt; limit:
      base += num
      num += 1
      calc += f&quot; + {num}&quot;
  print(base)
  print(f&quot;The consecutive sum: {calc} = {base}&quot;)
  </code></pre>
  <p>So for example, if the input is 10, the output should be 10 and underneath that should be &quot;The consecutive sum: 1 + 2 + 3 + 4 = 10.&quot; If the input is 18, the output should be 21 and underneath that should be &quot;The consecutive sum: 1 + 2 + 3 + 4 + 5 + 6 = 21.&quot;</p>
  <p>Right now I can get it to print the final result (base) and have gotten it to print out the calculation, but it prints out one integer too many. If the input is 10, it prints out 1 + 2 + 3 + 4 + 5 when it should stop before the 5.</p>