+ 2
I managed to compare user input to pc if they drew. But I can't manage to compare them if one of them win, any help?
4 Antworten
+ 4
I mean something like this
import random
# RPS = Rock Paper Scissors
RPS = ["rock", "paper", "scissors"]
# Choice variables
y = random.choice(RPS)
x = input()
# PC input
r = "rock"
p = "paper"
s = "scissors"
# Print user_input
print("You chose " + x + ",")
if x==y:
print("it is draw")
elif x == p:
if y == s:
print("the computer choose scissors")
print("computer wins")
elif y == r:
print("the computer choose rock")
print("you win!")
#then complete dear ...
I don't know if the syntax is right or not but I hope you get the idea
+ 5
if user choose something{
if
elif
...
}
elif .... etc
I mean if user choose something then make another conditions inside if to know if he win or lose and the same for the three chioces
+ 3
Thanks!
+ 2
welcome friend