0
Whats wrong with this code?
Okay so, i wrote If userchoice == Rock and comchoice == Rock, print("Its A Draw!") Right? But it still doesnt. Sometimes it shows I picked Rock, Computer picked Rock, You Win! Why is this happening??? https://code.sololearn.com/cRzQprKc59ge/?ref=app
2 Answers
+ 3
I think the problem comes from 'and' having a higher precedence than 'or'.
A or B and C
is evaluated
A or (B and C)
For your code, you need parentheses to give the evaluation you want:
(A or B) and C
see https://docs.python.org/3/reference/expressions.html#operator-precedence
+ 1
David Ashton Ohhhhh. I tried it out and it works now, thank you so much!!!