Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Tree import *
- import operator
- def get_input(file):
- f = open(file, "r")
- result = list(map(lambda x: x[0:-1], f.readlines()))
- f.close()
- return result
- def solve6a():
- input = get_input("input")
- t = Tree()
- for line in input:
- t.add_node(line)
- t.compute_orbits_per_node()
- total_orbits = 0
- for n in t.nodes:
- total_orbits += n.orbits
- print("6a: Total orbits: {}".format(total_orbits))
- t.nodes.sort(key=operator.attrgetter('orbits'))
- print(t.nodes)
- solve6a()
Advertisement
Add Comment
Please, Sign In to add comment