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

4th Jan 2019, 6:34 AM
Zinnur Hossain
Zinnur Hossain - avatar
2 Respostas
+ 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
4th Jan 2019, 6:54 AM
David Ashton
David Ashton - avatar
+ 1
David Ashton Ohhhhh. I tried it out and it works now, thank you so much!!!
4th Jan 2019, 7:04 AM
Zinnur Hossain
Zinnur Hossain - avatar