On 5 February 2017 at 09:02, boB Stepp <robertvst...@gmail.com> wrote: > py3: a > ['Mary', 'had', 'a', 'little', 'lamb', 'break'] > py3: for w in a: > ... print(w) > ... print('Huh?') > File "<stdin>", line 3 > print('Huh?') > ^ > SyntaxError: invalid syntax > > I don't understand why this throws a SyntaxError. If I wrap > essentially the same code into a function it works:
>From [1]: "When a compound statement is entered interactively, it must be followed by a blank line to indicate completion (since the parser cannot guess when you have typed the last line). Note that each line within a basic block must be indented by the same amount." Does that help? [1] https://docs.python.org/3/tutorial/introduction.html _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor