Created
January 26, 2019 09:00
-
-
Save afrieirham/c045f33c92f89fb35cd9a449b54b65b2 to your computer and use it in GitHub Desktop.
Solution for Project Euler #6
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
def sumOfSqure(number): | |
total = 0 | |
for i in range(1, number + 1): | |
total += i*i | |
return total | |
def squareOfSum(number): | |
total = 0 | |
for i in range(1, number + 1): | |
total += i | |
total *= total | |
return total | |
def run(number): | |
print(squareOfSum(number) - sumOfSqure(number)) | |
run(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment