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