[Solved] Python making a counter


I would suggest a simplified “architecture”. Your functions to get the user and computer choices should return values that can be compared.

import random

CHOICES = ('rock', 'paper', 'scissors')

def get_user_choice():
    choice = input('Rock, paper, or scissors? ')
    choice = choice.lower().strip()
    if choice not in CHOICES:
        print('Please select one of rock, paper, or scissors')
        choice = get_user_choice()
    return choice

def get_computer_choice():
    return random.choice(CHOICES)

def play_round():
    user_choice = get_user_choice()
    computer_choice = get_computer_choice()
    print('You selected', user_choice)
    print('Computer selected', computer_choice)
    # Compare choices here
    # Return value indicating win, loss, or draw

def play():
    wins = 0
    losses = 0
    draws = 0
    result = play_round()
    # Update wins, losses, or draws according to the result
    # Prompt user to play again or quit
    return wins, losses, draws

if __name__ == '__main__':
    wins, losses, draws = play()
    # Report wins, losses, and draws

solved Python making a counter