Unable to get output of rps

import random

def play() :
    user = input("What is ur choice ? 'r' for rock 'p' for paper 's' for scissor")
    computer = random.choice(['r', 'p', 's'])

    if user == computer :
        return "It's a tie"

    if is_win(user, computer) :
        return "You won!"

    return "YOU Lose!"

def is_win(player, opponent) :
    if (player == 'r' and opponent == 's') or (player == 'p' and opponent == 'r') or (player == 's' and opponent == 'p') :
        return True

After running it my output is not showing its displaying in this way :

There are two functions in the code, but in he pasted part there’s no code that would call play() to actually play.

sry i didnt undertood

Is there anything else in the game.py?

When function is defined, the code in it is not executed automatically when file containing it is run. That function needs to be called explicitly first.

tq very much.I got it

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.