Working out solutions for Advent of Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

01a.py 241B

12345678910
  1. def main():
  2. with open("01ain.txt", "r") as file:
  3. lines = file.readlines()
  4. masses = [int(x) for x in lines]
  5. fuels = [(x//3) - 2 for x in masses]
  6. print(fuels)
  7. print(sum(fuels))
  8. if __name__ == "__main__":
  9. main()