Style Guide¶
Readable beginner code is a course goal, not decoration. Use style choices that help another person follow the program.
Naming¶
- Prefer
total_costovertc. - Use singular names for one value and plural names for lists when practical.
- Match the name to the purpose, not merely the type.
Layout¶
- Use blank lines to separate meaningful sections.
- Keep indentation consistent.
- Avoid crowding several unrelated ideas onto one line.
Functions¶
- Give each function one main job.
- Choose parameter names that reveal their meaning.
- Return values when later code needs a result.
Comments¶
Comments should explain purpose or a non-obvious choice. They should not repeat what a straightforward line of code already says.