Created
February 10, 2020 15:08
-
-
Save AmosAidoo/d5d6278de51a768129103ab111fb4993 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sum = 0 #Store the sum of the numbers | |
sum_squares = 0 #Store the squares of the sum | |
for i in range(1, 101): | |
sum_squares = sum_squares + (i ** 2) #Compute the squares of the sum | |
sum = sum + i #Compute the sum | |
ans = sum**2 - sum_squares #Do the subtraction | |
print(ans) #print the answer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment