Skip to content

Instantly share code, notes, and snippets.

@kmonsoor
Created Jan 20, 2014
Embed
What would you like to do?
My solution for ProjectEuler problem# 41
def is_triangle(w):
return sum([ord(c)-64 for c in w]) in TN
L = list(eval(open('words.txt').readlines()[0])) #loading data
# creating triangle number list as i don't want to check triagulity every time
i,TN = 0,[]
for j in range(1,30):
i += j; TN.append(i)
#final check
print sum([1 for w in L if is_triangle(w)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment