+ 2

Help me debug this

I was coding that but I dont know where I do mistake. Here is my code: import random wply="You won the game!" wpc="Computer won the game!" go="Game Over" lc=[rock, paper, scissors] ply=input("What will you choose? ") pc=random.choice(lc) if ply==pc: print("Draw") if ply==rock && pc== scissors: print(wply) if ply==paper && pc==rock: print(wply) if ply==scissors && pc==paper print(wply) else print(wpc)

4th Jan 2017, 6:03 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
7 Answers
+ 3
Thx! I fixed the and one!
4th Jan 2017, 6:12 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 3
Ok so I'm uploading the code as 'Rock, paper, scissors!'! Hope you like it!
4th Jan 2017, 6:23 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 2
Omg i forgot to place game over
4th Jan 2017, 6:09 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 2
Python uses the "and" keyword instead of "&&". For example: if ply == rock and pc == scissors: print(wply) Also rock, paper, and scissors are going to give you an error because they're not defined. You need to either define then as variables or wrap them in quotes.
4th Jan 2017, 6:10 PM
James Durand
James Durand - avatar
+ 2
ikr i forgot : but now fixed, check Rock, Paper, Scissors!
4th Jan 2017, 8:17 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 1
also you forgot write ':' after if
4th Jan 2017, 8:06 PM
Maxim Kuzmin
Maxim Kuzmin - avatar
+ 1
colon, python uses "and" instead of &&
4th Jan 2017, 8:16 PM
Sharique Ansari
Sharique Ansari - avatar