Created
September 21, 2012 18:05
-
-
Save adamancini/3762994 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
## euler9 | |
# import euler9 | |
# will give you access to the euler9 function from other scripts | |
# and wrapping everything else in a main() function and putting it | |
# after the if __name__ block will keep that code from being executed | |
# if the file is simply imported. | |
def euler9(): | |
for k in range(0,33): | |
for j in range(0,1000): | |
for i in range(0,1000): | |
if i*i + j*j == k*k: | |
if i + j + k == 1000: | |
return i*j*k | |
def main(): | |
print euler9() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment