Day 2 2022
This commit is contained in:
parent
6536342c86
commit
288dd5010d
3 changed files with 2572 additions and 0 deletions
2500
Python/2022/02/input
Normal file
2500
Python/2022/02/input
Normal file
File diff suppressed because it is too large
Load diff
72
Python/2022/02/main.py
Normal file
72
Python/2022/02/main.py
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
input = open("input", 'r')
|
||||
#input = open("sample", 'r')
|
||||
|
||||
data = []
|
||||
|
||||
score1 = 0
|
||||
score2 = 0
|
||||
|
||||
win = 6
|
||||
draw = 3
|
||||
lose = 0
|
||||
|
||||
for line in input:
|
||||
split = line.split(" ")
|
||||
elf = split[0]
|
||||
you = split[1].strip()
|
||||
|
||||
# Part 1
|
||||
if you == "X":
|
||||
score1 += 1
|
||||
if elf == "A":
|
||||
score1 += draw
|
||||
if elf == "B":
|
||||
score1 += lose
|
||||
if elf == "C":
|
||||
score1 += win
|
||||
elif you == "Y":
|
||||
score1 += 2
|
||||
if elf == "A":
|
||||
score1 += win
|
||||
if elf == "B":
|
||||
score1 += draw
|
||||
if elf == "C":
|
||||
score1 += lose
|
||||
elif you == "Z":
|
||||
score1 += 3
|
||||
if elf == "A":
|
||||
score1 += lose
|
||||
if elf == "B":
|
||||
score1 += win
|
||||
if elf == "C":
|
||||
score1 += draw
|
||||
|
||||
# Part 2
|
||||
if you == "X":
|
||||
score2 += lose
|
||||
if elf == "A":
|
||||
score2 += 3
|
||||
if elf == "B":
|
||||
score2 += 1
|
||||
if elf == "C":
|
||||
score2 += 2
|
||||
elif you == "Y":
|
||||
score2 += draw
|
||||
if elf == "A":
|
||||
score2 += 1
|
||||
if elf == "B":
|
||||
score2 += 2
|
||||
if elf == "C":
|
||||
score2 += 3
|
||||
elif you == "Z":
|
||||
score2 += win
|
||||
if elf == "A":
|
||||
score2 += 2
|
||||
if elf == "B":
|
||||
score2 += 3
|
||||
if elf == "C":
|
||||
score2 += 1
|
||||
|
||||
|
||||
print(score1)
|
||||
print(score2)
|
||||
0
Python/2022/02/sample
Normal file
0
Python/2022/02/sample
Normal file
Loading…
Add table
Add a link
Reference in a new issue