Squared Numbers
1234567891011121314151617181920212223242526272829303132
max = 100
def naturalSumSquared (max):
numberCount = 0
totalSum = 0
for numberCount in range(max):
numberCount += 1
totalSum += numberCount
totalSum **= 2
return totalSum
def naturalSquaredSum (max):
numberCount = 0
totalSum = 0
for numberCount in range(max):
numberCount += 1
totalSum += (numberCount**2)
return totalSum
print(naturalSumSquared(max))
print(naturalSquaredSum(max))
print(naturalSumSquared(max) - naturalSquaredSum(max))
Python
INFO