I am quite new to programming and I am working on rock, paper, scissor games. It does all the work except the previous part ( whenever I try to execute the script I say, then it says: If you do not want to enter Second, as you or variable If the assignment is not permitted in Python's if part). X = ("rock") y = ("paper") z = ("scissor" print (x) print (y) print (z) choice = 1 (x, y, Z) Option 2 = (X, Y, Z) Import random printing ("player selected 1 ...") print (random.choice (Options1) print ("player 2 selected ...") print (random.choice ( Options2)) random.choice (options1) = rock and random.choice (options2) = scissors: print ("player 1 win")
file "
== not
= :
if random.choice (options1) == "rock" And random.choice (options2) == "Scissors": print ("Player 1 win")
rock and < No variables named code> scissors have been declared , so you should not have them cited around to make their wire Otherwise you
x ,
z point to that string "rock" and "scissors":
If random.choice (options1) == x and random.choice (options2) == z: print ("player 1 win")
== similarity Is used for testing and for the
= assignment.
& gt; & Gt; & Gt; "Foo" == "bar" false & gt; & Gt; & Gt; "Foo" == "foo" true
if statement, you receive
SyntaxError Are there.
No comments:
Post a Comment