mirror of
https://github.com/correl/euler.git
synced 2024-11-30 11:09:52 +00:00
10 lines
274 B
Python
10 lines
274 B
Python
|
def squarediff(n):
|
||
|
sumofsquares = sum([x**2 for x in range(n + 1)])
|
||
|
print 'Sum of squares', sumofsquares
|
||
|
squareofsum = sum(range(n + 1))**2
|
||
|
print 'Square of sum', squareofsum
|
||
|
print 'Difference', squareofsum - sumofsquares
|
||
|
|
||
|
squarediff(10)
|
||
|
squarediff(100)
|