Skip to content

Instantly share code, notes, and snippets.

@anirudhjayaraman
Created September 1, 2015 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anirudhjayaraman/d7d54274ed8b9f861cf2 to your computer and use it in GitHub Desktop.
Save anirudhjayaraman/d7d54274ed8b9f861cf2 to your computer and use it in GitHub Desktop.
Project Euler Problem 13
# Read the problem matrix into an array in python
filename = 'euler13.txt'
with open(filename, "r") as ins:
array = []
for line in ins:
array.append(line)
# Convert the array into an array of integers
newArray = []
for i in array:
newArray.append(int(i))
# Sum up the array and print the first 10 numbers of the sum as a string
arraySum = sum(newArray)
print str(arraySum)[:10]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment