Run code and inspect the result
Python executes instructions in order. A print statement displays a value so you can check what the program is doing. Use a short file and change one line at a time when you are learning a new behavior.
Read errors as clues
An error message often names the line where execution stopped. Check spelling, brackets, quotation marks, and indentation around that line. The reported line is a useful starting point, even when the original mistake is just above it.
Try it
Run print("Hello, world") in a Python interpreter. Change the text and run it again. Then remove a quotation mark and read the error before correcting it.
Key takeaways
- Python follows instructions in order.
- Print output to inspect a value.
- Use error messages to guide small fixes.