When Python is first installed, the default setting executes users' code input line-by-line. But sometimes I need to write programs that execute multiple lines at once. Is there a setting in Python where I can change the code execution to one block at once?
>>> if (n/2) * 2 == n:;
print 'Even';
else: print 'Odd'
Error:
SyntaxError: invalid syntax
When I tried to run the above code, I got an invalid syntax error on the else.
;) (as part of the language, outside a string). If you're using semicolons, you're probably doing something wrong. Do not use semicolons unless you're absolutely sure you know why you need one.