Skip to content

Instantly share code, notes, and snippets.

@iiogmgo
Last active August 29, 2015 14:22
Show Gist options
  • Save iiogmgo/f2bf234daa94252ac1c1 to your computer and use it in GitHub Desktop.
Save iiogmgo/f2bf234daa94252ac1c1 to your computer and use it in GitHub Desktop.
projecteuler_09
import time
import math
def pytha_tri(start, num):
tri_set = []
for a in range(start, num+1):
for b in range(a, num+1):
c = math.sqrt(a**2+b**2)
if(a+b+c==1000):
tri_set.append([a,b,int(c)])
print 'the answer :', int(a*b*c)
return tri_set
if __name__== '__main__':
t = time.time()
print pytha_tri(1,1000)
print 'python Elapsed %.02f' % (time.time()-t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment