Concept Explanation
This lesson is about getting comfortable with the small syntax details that make Python either run cleanly or fail immediately. At this stage, you are not trying to write clever code. You are training yourself to notice structure: where indentation starts, where strings open and close, and where a missing parenthesis can break the whole file. A lot of beginners think syntax mistakes mean they are bad at programming. That is not true. Syntax errors are normal. The important skill is learning to spot them quickly instead of staring at the screen and guessing. In this lesson, you will work with a short function, run it, break it on purpose, and fix it again. That is how syntax becomes familiar. By the end of this lesson, you should be able to: • read a short Python function and understand its indentation structure, • recognize common syntax mistakes before they waste too much time, • fix broken quotes, parentheses, and indentation with more confidence. Why this matters: if you become calm around syntax errors now, future lessons will feel much easier because small mistakes will stop slowing you down.
Where to Put the Code
- Define color and position variables at the top.
- Create shape drawing or placement logic in the middle.
- Render output (print, canvas, SVG, or styled block) at the end.
Command Reference
- Use four spaces for indentation inside a function and keep that style consistent in the whole file.
- Check quotes and parentheses before assuming the logic is wrong; many beginner errors are just broken syntax.
- Run the file from the terminal after each small change so you can connect the edit to the result.
- Keep the example short enough that you can read every line without losing track of structure.
Step-by-step Guide
- Create a file named `syntax_drill.py` and type the example by hand instead of pasting it.
- Run the file once and make sure both lines print correctly.
- Delete one closing parenthesis from a `print` line, run the file, read the error, and then fix it.
- Change one pair of quotes incorrectly, run again, and restore the correct version after you understand the problem.
- Write one short note explaining what indentation does inside the `greet` function.
Practice Exercises
- Add a third `print` line inside `greet` and make sure the file still runs without syntax errors.
- Create one broken version with bad indentation, then fix it and describe what Python complained about.
- Write two syntax mistakes you want to watch for from now on when writing Python by hand.
Coding Challenges
- Rewrite the script so `greet` prints three lines, but keep the formatting clean and readable.
- Create a second tiny function in the same file and call both functions from the `if __name__ == "__main__":` block without breaking the syntax.
Mini Practice Tasks
- Run the script three times after three tiny edits so syntax checking starts to feel normal.
- Turn on line numbers in your editor if they are hidden; they help a lot when Python reports an error.
- Write one sentence to yourself: `Small syntax errors are normal, and I know how to fix them step by step.`
Common Mistake
Mixing x and y axes or using wrong coordinate origin causes shapes to appear in unexpected places.
Real-life Mini Challenge
Draw one square, one triangle, and one circle, then move X marker 2 steps right and 1 step down.