Learn the concept
A program is a sequence of instructions that transforms inputs into outputs. Python reads your source code, compiles it to an internal representation, and executes it in a runtime. A file ending in .py contains source; the interpreter runs it. A terminal is where you enter commands, while an editor is where you change the file.
Begin with a supported Python 3 installation. Run python3 --version in a terminal. On systems using the Windows launcher, py --version may be the equivalent. Create a folder, save a file named hello.py, and run python3 hello.py from that folder. Do not paste terminal commands into the Python prompt. The >>> prompt indicates an interactive interpreter, where you enter Python expressions.
Learn to distinguish a syntax error, a runtime exception, and an incorrect result. They require different investigations. Read the filename and line number in the error before changing code.
Run and inspect
print("Hello, engineer")
print(2 + 3)
Your exercise
Run the script, change the greeting, and deliberately remove a closing parenthesis. Restore it, then try dividing by zero. Record how the two errors differ.
Check your understanding
The working program prints a greeting and 5. You can explain why malformed syntax prevents execution while division by zero fails during execution.