1st Feb 2018, 12:07 PM
Raphael Shay
Raphael Shay - avatar
4 Respuestas
+ 1
Idk py but i can tell what is wrong... x is the users input and y is the computers choice U had done if x == y: //to do In js it is like. [This is your code but in js version] if(x == y){ alert('its a draw') } [Correct code in js version] if(x == 'paper' && y == 'paper'){ alert('its a draw') } Now in py....I think there should be an operator that checks of both the conditions are true then execute given code or if not then didnt execute the code as in js it is && ....sorry idk what it is in py....check course or maybe u already know (py) if x == 'paper' (that operator) y == 'paper': //to do
1st Feb 2018, 12:19 PM
Rohit
Rohit - avatar
+ 2
Like this if x == p and y == p: print("It's a draw!")
1st Feb 2018, 12:22 PM
Rohit
Rohit - avatar
+ 2
Because x ==y is like (assuming player choose paper and computer choose scissor) 'paper' == 'scissor' As paper is not equal to scissor the code is not executed
1st Feb 2018, 1:17 PM
Rohit
Rohit - avatar
+ 1
Can't you do x == y?
1st Feb 2018, 12:55 PM
Raphael Shay
Raphael Shay - avatar