Back to questions
JuniorTheoryCommon
What happens when this program runs?
print("start")
print("end")An IndentationError, and nothing prints
- Expecting
startto print first: Python checks the indentation of the whole file before it runs, so the error stops it before a single line executes. - Expecting the extra indent to be ignored: an indent opens a block, and a block may start only after a line ending in a colon.
- Which line does the traceback point to, and which of its lines names the error?
- What prints if the last line is
pritn("end")with no indent?