I'm making a simple Python Rock Paper Scissors game for a school project. I'm new to Python but I'm getting the error
ParseError: bad input on line 12 in main.py
Here is my code:
import random
choice = input("Welcome to rock paper scissors! You go first.")
choice = choice.upper()
a = [1, 2, 3]
b = random.choice(a)
if b == 1:
print("My choice: ROCK")
elif b == 2:
print("My choice: PAPER")
elif b = 3:
print("My choice: SCISSORS")
print("Your choice: " + choice)
if choice == b:
print "Draw. Play again!"
So it's the Elif statements that are giving me trouble, but I don't see how they could possibly be wrong, I've looked everywhere.
Your indentation is wrong: the elif must be at the same level. Besides, you wrote elif b = 3, but it should be elif b == 3.
if b == 1:
print("My choice: ROCK")
elif b == 2:
print("My choice: PAPER")
elif b == 3:
print("My choice: SCISSORS")
Note that the code as you posted raises an IdentationError in a Python 3 interpreter.