python-euler/solutions/006/sumsquaredifference.py

12 lines
330 B
Python
Raw Permalink Normal View History

2023-07-31 12:51:34 -04:00
sumOfSquares = 0
squareOfSum = 0
for i in range(1,101):
squareOfSum += i
sumOfSquares += i * i
squareOfSum = squareOfSum * squareOfSum
difference = squareOfSum - sumOfSquares
print("The difference between the sum of the squares of the first one hundred natural numbers and the square of the sum is: ", str(difference))