Jan-25-2019, 08:20 AM
maybe a better choice of data structure, using f-strings, random.choice
import random game = {"Paper":[("Rock", "Win"), ("Paper", "Draw"), ("Scissors", "Lose")], "Rock":[("Scissors", "Win"), ("Rock", "Draw"), ("Paper", "Lose")], "Scissors":[("Paper", "Win"), ("Scissors", "Draw"), ("Rock", "Lose")]} scoring = {"Win": 1, "Draw": 0, "Lose": -1} score = 0 while True: print("\nPaper, Rock, Scissors, or Quit") user_choice = input("Please enter your choice: ").title() if user_choice == "Quit": break try: computer_choice, result = random.choice(game[user_choice]) except KeyError: print("Invalid Entry") else: score += scoring[result] print(f"Your choice {user_choice} | Computer choice {computer_choice} | You {result} | Your Score {score}") input(f"Final score: {score}")Further steps - maybe using collections.namedtuple
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs