0% found this document useful (0 votes)
1 views1 page

Coding Principles Summary

The document outlines key coding principles including clarity, modularity, and the DRY principle to enhance code quality. It emphasizes the importance of input validation, algorithmic thinking, and adhering to PEP 8 style guidelines. Additionally, it provides a memory tip for structuring code flow effectively.

Uploaded by

shauntmogale
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views1 page

Coding Principles Summary

The document outlines key coding principles including clarity, modularity, and the DRY principle to enhance code quality. It emphasizes the importance of input validation, algorithmic thinking, and adhering to PEP 8 style guidelines. Additionally, it provides a memory tip for structuring code flow effectively.

Uploaded by

shauntmogale
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Coding Principles – One Page Summary

1. Clarity & Readability


Use meaningful variable names and proper indentation.

2. Modularity
Break code into smaller reusable parts (functions).

3. DRY Principle
Don’t Repeat Yourself – avoid duplicated code.

4. KISS Principle
Keep It Simple – avoid unnecessary complexity.

5. Input Validation
Always check user input using loops.

6. Loop Pattern (IMPORTANT)


value = input()
while condition:
process
value = input()

7. Algorithmic Thinking
Plan steps before coding.

8. Comments
Explain code clearly, but don’t over-comment.

9. PEP 8 Style
Use 4 spaces, proper spacing, lowercase variables.

10. Avoid Unnecessary Code


Keep code clean and efficient.

11. Sentinel Values


Special value (e.g., 0 or negative) to stop loops.

12. Data Types


int, float, str – use correctly.

13. Nested Loops


Loop inside another loop (e.g., drawing patterns).

14. Auto-Marker Rule


No extra prompts or text unless required.

Memory Tip:
INPUT → WHILE → PROCESS → INPUT → OUTPUT

You might also like