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