Created
August 7, 2017 14:59
-
-
Save vpatov/e30c1107f988e30e962b6667a73683c3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
""" | |
If you want to use a dictionary | |
""" | |
galaxies = {} | |
for line in open('problem1_input.txt','r'): | |
parts = map(str.strip,line.split(',')) | |
name,x,y,benefit = parts | |
galaxies[name] = {"x":int(x), "y":int(y), "benefit": int(benefit)} | |
""" | |
If you want a list of tuples | |
""" | |
galaxies = [] | |
for line in open('problem1_input.txt','r'): | |
parts = map(str.strip,line.split(',')) | |
name,x,y,benefit = parts | |
galaxies.append((name,int(x),int(y),int(benefit))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment