Created
April 21, 2019 13:19
-
-
Save XayOn/c9d0f206ca0ce741d8916f84806dd8ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
CHOICES = {'rock': 'scissors', 'paper': 'rock', 'scissors': 'paper'} | |
SCORES = {"user": 0, "comp": 0, 'draw': 0} | |
while not any(a == 3 for a in SCORES.values()): | |
user = input("Enter rock, paper or scissors: ") | |
SCORES[{True: "user", False: "comp"}.get( | |
CHOICES.get(user) == random.choice(list(CHOICES.keys())), 'draw')] += 1 | |
print(f'U:{SCORES["user"]}. C: {SCORES["comp"]}, D: {SCORES["draw"]}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment