This commit is contained in:
2022-12-02 09:37:34 +02:00
parent ecaabb996d
commit a4cf4d6a4a

49
02/b.py
View File

@@ -3,33 +3,37 @@ import os
f = open(os.path.dirname(__file__)+"/input.txt", "r")
tot = 0
selection = {'X': 1, 'Y': 2, 'Z': 3}
i = 0
for l in f:
l.strip()
choices = l.split(" ")
result = 'draw'
match choices[0]:
v = choices[0]
o = choices[1]
print (v + " " + o)
match v:
case 'A':
match choices[1]:
case 'Y':
result = 'win'
case 'Z':
result = 'loss'
if o == 'Y':
result = 'win'
print("voitto")
if o =='Z':
result = 'loss'
print("tappio")
case 'B':
match choices[1]:
case 'X':
result = 'loss'
case 'Z':
result = 'win'
if o == 'X':
result = 'loss'
print("tappio")
if o == 'Z':
result = 'win'
print("voittko")
case 'C':
match choices[1]:
case 'X':
result = 'win'
case 'Y':
result = 'loss'
value = selection.get(choices[1])
if o == 'X':
result = 'win'
print("voitto")
if o == 'Y':
result = 'loss'
print("tappio")
match choices[1]:
case 'X':
@@ -43,5 +47,8 @@ for l in f:
tot = tot + 3
if result == 'win':
tot = tot + 6
i = i + 1
print(tot)
print(tot)
print(i)