0
Всякий раз, когда я нажимаю F5, чтобы запустить свой код, сообщение об ошибке всплывает, что читает «неверный синтаксис», и пробел после «True» в следующей строке:Необъяснимая Invalid Синтаксис в Python 3.4.2
while not chosen4 == True
Я понятия не имею, что вызывает эту ошибку. Остальная часть исходного кода ниже:
import time
playAgain = False
while not playAgain == True:
gameOver = False
print ("""Press ENTER to begin!
""")
input()
print("""text""")
time.sleep (2)
print ("""text""")
time.sleep (7)
print ("""text""")
print("""(Press a number and then ENTER!)""")
while not gameOver == True:
direction = input ("Your chosen action: ")
print("You chose {0}!".format(direction))
time.sleep (2)
if direction == "1":
print ("""text""")
time.sleep (6)
print ("""text""")
chosen1 = False
while not chosen1 == True:
direction1 = input ("Your chosen action: ")
print ("You chose {0}!".format(direction1))
time.sleep (2)
if direction1 == "3":
print ("""text""")
time.sleep (2)
print("""text""")
time.sleep (8)
print("""text""")
gameOver = True
break
elif direction1 == "4":
print("""text""")
time.sleep (3)
chosen4 = False
while not chosen4 == True
#The above line is where the 'invalid syntax' is.
direction4 = input ("Your chosen action: ")
print "You chose {0}!".format(chosen4)
time.sleep (2)
if chosen4 chosen4 == "7":
print ("text")
gameOver = True
break
elif chosen4 == "8":
print ("text")
gameOver = True
break
else:
tryagain
else:
print ("""text""")
time.sleep (3)
elif direction == "2":
print ("""text""")
time.sleep (2)
print("""text""")
time.sleep (3)
print("""text""")
chosen2 = False
while not chosen2 == True:
direction2 = input ("Your chosen action: ")
print ("You chose {0}!".format(direction2))
time.sleep (2)
if direction2 == "5":
print ("""text""")
time.sleep (8)
gameOver = True
break
elif direction2 == "6":
print ("""text""")
break
else:
print ("""text""")
elif direction == "0":
print ("""text""")
else:
print ("""text""")
if gameOver == True:
input()