Я просматриваю книгу, которая в этот момент в книге требует от меня сделать небольшую видеоигру, которая вызывает функции, использует if
, while
- по существу, все вещи до сих пор в книге. Но, я получаю эту ошибку в этой части моего кода:Проблемы с ошибками синтаксиса и отступов
Код изменен, получите новую ошибку.
File "ex35_study.py", line 24 third_scenario_code() IndentationError: unindent does not match any outer indentation level
Вот мой код:
options_thirdscenario_actions = ['Examine the door', 'Try to force it']
def third_scenario_code():
print "Let me try to crack this thing up, says Lars as he starts to type in the panel. You hear the sounds of the fight out there, there's not much time left. "
print "After receiving several commands a window with a code pop ups. "
print codefile.read()
def third_scenario():
print "You two get out of the cell and approach to the exit, a long corridor is ahead of you, flashing red lights indicate an state of emergency, you must evacuate."
print "As soon as you two approach to the door, it closes"
print "Crap it must be the emergency system, we have been detected"
next = raw_input("What do you do> ")
if next == 'Examine the door':
print "A small panel comes out, requires to enter a code of words"
third_scenario_code()
elif next == 'Try to force it':
print "You try to force the door with no result"
print options_thirdscenario_actions
next2 = raw_input("What else do you do> ")
if next2 = 'Examine the door'
third_scenario_code()
else:
print "You already did that"
Я получаю подобную ошибку на всю программу, и я подозреваю, что это что-то делать с отступом, но я попробовал каждый предложение, которое я вижу в google без плодотворного результата. заранее спасибо.
'third_scenario_code()' не следует отступать так много –
Как вы можете видеть, строки 'third_scenario_code' имеют неправильный отступ. Никогда пользовательские вкладки и всегда 4 пробела для отступов. Настройте свой редактор, чтобы помочь вам. – Daniel