emt
This commit is contained in:
35
02/b.py
35
02/b.py
@@ -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'
|
||||
v = choices[0]
|
||||
o = choices[1]
|
||||
print (v + " " + o)
|
||||
|
||||
match choices[0]:
|
||||
match v:
|
||||
case 'A':
|
||||
match choices[1]:
|
||||
case 'Y':
|
||||
if o == 'Y':
|
||||
result = 'win'
|
||||
case 'Z':
|
||||
print("voitto")
|
||||
if o =='Z':
|
||||
result = 'loss'
|
||||
print("tappio")
|
||||
case 'B':
|
||||
match choices[1]:
|
||||
case 'X':
|
||||
if o == 'X':
|
||||
result = 'loss'
|
||||
case 'Z':
|
||||
print("tappio")
|
||||
if o == 'Z':
|
||||
result = 'win'
|
||||
print("voittko")
|
||||
case 'C':
|
||||
match choices[1]:
|
||||
case 'X':
|
||||
if o == 'X':
|
||||
result = 'win'
|
||||
case 'Y':
|
||||
print("voitto")
|
||||
if o == 'Y':
|
||||
result = 'loss'
|
||||
value = selection.get(choices[1])
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user