This commit is contained in:
2023-12-25 19:05:32 +01:00
commit 8183467b60
15 changed files with 5590 additions and 0 deletions

27
02/02-02.py Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# parse input
input_file = open("input", "r")
total_score = 0
for li in input_file:
li = li.strip().split()
# Score for loose, draw, win
if li[1] == "X":
total_score += 0
elif li[1] == "Y":
total_score += 3
elif li[1] == "Z":
total_score += 6
# Score for Stone, Paper, Scissor
if (li[0] == "B" and li[1] == "X") or (li[0] == "A" and li[1] == "Y") or (li[0] == "C" and li[1] == "Z"):
total_score += 1
elif (li[0] == "C" and li[1] == "X") or (li[0] == "B" and li[1] == "Y") or (li[0] == "A" and li[1] == "Z"):
total_score += 2
else:
total_score += 3
print(total_score)
input_file.close()
print("Lösung 2:", total_score)