first 13 stars
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# The score for a single round is the score for the shape
|
||||
# you selected (1 for Rock, 2 for Paper, and 3 for Scissors)
|
||||
# plus the score for the outcome of the round
|
||||
# (0 if you lost, 3 if the round was a draw, and 6 if you won).
|
||||
|
||||
scores = {
|
||||
"X": 1, #Rock
|
||||
"Y": 2, #Paper
|
||||
"Z": 3, #Scissors
|
||||
"A": 1, #Rock
|
||||
"B": 2, #Paper
|
||||
"C": 3 #Scissors
|
||||
}
|
||||
|
||||
score = 0
|
||||
with open("input.txt", "r") as f:
|
||||
for line in f.readlines():
|
||||
hands = line.strip("\n").split(" ")
|
||||
theirs = scores[hands[0]]
|
||||
ours = scores[hands[1]]
|
||||
score += ours
|
||||
if ours > theirs and not (ours == 3 and theirs == 1):
|
||||
score += 6
|
||||
if ours == theirs:
|
||||
score += 3
|
||||
if ours == 1 and theirs == 3:
|
||||
score += 6
|
||||
|
||||
print(score)
|
||||
Reference in New Issue
Block a user