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? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

https://code.sololearn.com/cxxeB6hS7E99/?ref=app

29th Jan 2018, 8:49 AM
Raphael Shay
Raphael Shay - avatar
4 Answers
+ 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
29th Jan 2018, 9:39 AM
Abdurrahman Abulgasim
Abdurrahman Abulgasim - avatar
+ 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
29th Jan 2018, 9:20 AM
Abdurrahman Abulgasim
Abdurrahman Abulgasim - avatar
+ 3
Thanks!
29th Jan 2018, 11:14 AM
Raphael Shay
Raphael Shay - avatar
+ 2
welcome friend
29th Jan 2018, 11:28 AM
Abdurrahman Abulgasim
Abdurrahman Abulgasim - avatar