File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# --- Day 3: Lobby ---
22
3+
34def part1 ():
45 lines = """
56 987654321111111
67 811111111111119
78 234234234234278
89 818181911112111
9- """ .split ("\n " )
10+ """ .split (
11+ "\n "
12+ )
1013
11- lines = open (' ../inputs/day-03.txt' , 'r' ).readlines ()
14+ lines = open (" ../inputs/day-03.txt" , "r" ).readlines ()
1215 total = 0
1316 for line in lines :
1417 # split to digits
@@ -25,13 +28,16 @@ def part1():
2528 total += max_joltage
2629 return total
2730
31+
2832def part2 ():
2933 lines = """987654321111111
3034 811111111111119
3135 234234234234278
32- 818181911112111""" .split ('\n ' )
36+ 818181911112111""" .split (
37+ "\n "
38+ )
3339
34- lines = open (' ../inputs/day-03.txt' , 'r' ).readlines ()
40+ lines = open (" ../inputs/day-03.txt" , "r" ).readlines ()
3541 # total = 0
3642 max_digits = 12
3743 total = 0
@@ -58,10 +64,11 @@ def part2():
5864 result .append (max_digit )
5965 start = max_pos + 1
6066
61- max_joltage = int ('' .join (map (str , result )))
67+ max_joltage = int ("" .join (map (str , result )))
6268 total += max_joltage
6369 return total
6470
71+
6572if __name__ == "__main__" :
6673 print ("Part 1:" , part1 ())
6774 print ("Part 2:" , part2 ())
Original file line number Diff line number Diff line change 1- # 4
1+ # 4
You can’t perform that action at this time.
0 commit comments