Adopted new convention from template
This commit is contained in:
parent
6912146be7
commit
3fe956d388
@ -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()}")
|
||||
print(f"Result for Problem 6 is {compute()}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user