# File: sumsq.py # sum the first few squares # # Matt Bishop, ECS 10, Spring 2014 # # # read in the number to go to # try: upper = int(input("How many squares should I sum? ")) except: print("Please enter a positive number!") else: # # add them up! # total = 0 for i in range(1, upper+1): total += i ** 2 print("The sum of the first", upper, "squares is", total)