I just not understand how that line of code work
p1 = input("enter the play user1")
p2 = input("enter the play user2")
choice = list(['paper', 'rock', 'scissors'])
if p1 not in choice:
print("dont u know the game")
if p2 not in choice:
print("dont u know the game")
if p1==p2:
print("its a draw")
if choice.index(p1) == (choice.index(p2)+1)%3:
print("player 2 wins")
if choice.index(p2) == (choice.index(p1)+1)%3:
print("player 1 wins")
index()
does? – Mark Ransom Aug 31 at 18:11choice[0]
(which returns 'paper') is all you need. – hookedonwinter Aug 31 at 18:12choice
? Read the documentation of that type! Hint: You can explore an object in the interactive CLI interface using e.g. thehelp()
function and thedir()
function. – Ulrich Eckhardt Aug 31 at 18:12