diff --git a/src/Python/Problems001-050/Problem006.py b/src/Python/Problems001-050/Problem006.py index ce8587c..8a4c614 100644 --- a/src/Python/Problems001-050/Problem006.py +++ b/src/Python/Problems001-050/Problem006.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python """ Created on 17 Jun 2017 @@ -25,15 +25,15 @@ def compute(): natural numbers and the square of the sum is 3025 − 385 = 2640. Find the difference between the sum of the squares of the first one - hundred natural numbers and the square of the sum. Statement + hundred natural numbers and the square of the sum. """ + n = 100 - square_of_sum = sum(i for i in range(1, n+1))**2 - sum_squares = sum(i**2 for i in range(1, n+1)) + square_of_sum = sum(i for i in range(1, n + 1)) ** 2 + sum_squares = sum(i**2 for i in range(1, n + 1)) diff = square_of_sum - sum_squares return diff if __name__ == "__main__": - - print(f"Result for Problem 6: {compute()}") \ No newline at end of file + print(f"Result for Problem 6 is {compute()}")