Elif gibt auf trinket.io „ParseError: bad input“ ausPython

Python-Programme
Anonymous
 Elif gibt auf trinket.io „ParseError: bad input“ aus

Post by Anonymous »

Ich mache ein einfaches Python-Spiel „Stein, Papier, Schere“ für ein Schulprojekt. Ich bin neu in Python, erhalte aber die Fehlermeldung

ParseError: bad input on line 12 in main.py

Hier ist mein Code:

Code: Select all

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!"
Es sind also die Elif-Aussagen, die mir Probleme bereiten, aber ich verstehe nicht, wie sie möglicherweise falsch sein könnten, ich habe überall gesucht.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post