diff --git a/006.py b/006.py new file mode 100644 index 0000000..91c8006 --- /dev/null +++ b/006.py @@ -0,0 +1,9 @@ +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)