Syntax and execution
Python uses indentation to group suites of statements and requires consistent structure. Source files are executed by the interpreter, while the interactive prompt evaluates entries incrementally. Comments begin with # outside strings. A syntax error prevents parsing; a runtime error occurs after successfully parsed code begins executing. python3 -m py_compile values.py checks whether a source file parses; python3 values.py then executes its actual statements and can reveal runtime errors. Distinguishing parsing from runtime behavior helps locate failures quickly and explains why a valid-looking file may compile successfully yet fail while evaluating a particular expression during execution. Mixing tabs and spaces or omitting a colon can break block structure; use consistent four-space indentation and read the reported location before changing unrelated statements in the program.
python3 -m py_compile values.py checks whether a source file parses; python3 values.py then executes its actual statements and can reveal runtime errors.
Distinguishing parsing from runtime behavior helps locate failures quickly and explains why a valid-looking file may compile successfully yet fail while evaluating a particular expression during execution.
Mixing tabs and spaces or omitting a colon can break block structure; use consistent four-space indentation and read the reported location before changing unrelated statements in the program.