title: How to calculate the value of the sum of squares defined as 1^2 + 2^2 + 3^2 + ... +n2 until a user specified sum has been reached
body: <p>This is what I have, but I don't know what to make the range so that I can stop it when the sum is reached.</p>
  
  <pre><code>total=0
  x=0
  n=int(input('What is the maximum sum? '))
  while x in range():
      x=x+1
      y= x**2
      total= total+y
      print(total)
      if total&gt;=n:
          print('Done')
  </code></pre>