Answer
$Code:$
Work Step by Step
$Code:$
import random
computer = random.randint(0, 3)
user = int(input("Sciessor (0) , rock (1) , paper(2):"))
print("the computer is ")
if computer == 0:
$ $ $ $ print("sciessor")
elif computer == 1:
$ $ $ $ print("rock")
else:
$ $ $ $ print("paper")
print("You are ")
if user == 0:
$ $ $ $ print("sciessor")
elif user == 1:
$ $ $ $ print("rock")
else:
$ $ $ $ print("paper")
if (computer == user):
$ $ $ $ print("it is a draw")
else:
$ $ $ $ win = (user == 0 and computer == 2) or (user == 1 and computer == 0) or (user == 2 and computer == 1)
$ $ $ $ $ $ $ $ if win:
$ $ $ $ $ $ $ $ $ $ $ $ print("you won")
$ $ $ $ $ $ $ $ else:
$ $ $ $ $ $ $ $ $ $ $ $ print("you lose")