Concept Explanation
This lesson brings the first setup lessons together into one small, complete script. You already practiced running files, fixing syntax, debugging mistakes, refactoring, testing simple helpers, and separating data from presentation. Now you use those habits in one place. The script in this lesson is still small on purpose. That is what makes it useful. A beginner project should be easy to run, easy to read, and easy to change without fear. If a teammate opened this file tomorrow, they should understand what it does in under a minute. Here, you will build a tiny profile formatter that creates sample records, checks that the data is reasonable, and prints clean output. Nothing fancy. Just a script that feels like a real mini project instead of a disconnected exercise. By the end of this lesson, you should be able to: • explain how data creation, validation, and rendering work together in one file, • run a mini project from top to bottom without guessing what happens next, • point to the exact place where future features such as CLI arguments or JSON export would be added. Why this matters: real learning happens when separate concepts stop feeling separate and start working together in one program.
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
- Keep the module docstring practical so another person knows how to run the file immediately.
- Use a small validation function before printing so obvious bad data fails early.
- Let `render_profile()` return a string; that keeps formatting easy to test and reuse.
- Treat `main()` as the final assembly step where the project comes together.
Step-by-step Guide
- Run the script exactly as the top docstring says and confirm each profile prints on its own line.
- Add one more profile and check whether the gold-versus-standard rule still behaves the way you expect.
- Temporarily give one profile a negative score, read the assertion message, then restore the data.
- Change the formatting in `render_profile()` without touching `build_profiles()` or `validate_profiles()`.
- Write one sentence describing where you would add command-line arguments if you wanted this project to accept real input later.
Practice Exercises
- Compare this dataclass-based version to the TypedDict lesson before it. Which one feels cleaner for a small project, and why?
- Add a function that returns the highest-scoring profile without changing how rendering works.
- Write a short note explaining why validation belongs before the printing loop, not after it.
Coding Challenges
- Add a JSON export function that turns the profiles into dictionaries while keeping the text renderer unchanged.
- Sort the profiles by points before printing and make sure the rest of the file still reads cleanly.
Mini Practice Tasks
- Save this file as a personal mini project, not just as a lesson exercise.
- Write one line in your notes: this is the first script where several Python ideas work together.
- Read the file from top to bottom once without running it and check if the flow feels obvious.
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.