Advertisement
desrtfx

Day_02

Dec 2nd, 2022
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. # Day02
  2.  
  3. scores_p1 = {"A X":4, "A Y":8, "B X":1, "A Z":3, "C X":7, "B Y":5, "B Z":9, "C Y":2, "C Z":6}
  4. scores_p2 = {"A Y":4, "A Z":8 ,"B X":1, "A X":3, "C Z":7, "B Y":5, "B Z":9, "C X":2, "C Y":6}
  5.  
  6. raw_data = open("Input_Day2.txt").read().split("\n")
  7. total_score_p1 = 0
  8. total_score_p2 = 0
  9.  
  10. for x in raw_data:
  11.     total_score_p1 += scores_p1[x.strip()]
  12.     total_score_p2 += scores_p2[x.strip()]
  13.  
  14. print(f"Part 01: {total_score_p1}")
  15. print(f"Part 02: {total_score_p2}")
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement