Best Coding Practices
The small habits (clear names, reading input correctly, testing edge cases, comparing against a slow answer) that separate a solution that works from one that almost does.
After this lesson you will be able to
- Write readable code: meaningful names, small functions, comments that explain why.
- Read contest input quickly and correctly, and print output in the exact format asked.
- Test a solution with a checklist of edge cases before submitting.
- Find a bug by reproducing it on the smallest failing input and tracing the variables.
- Compare a clever solution against a slow, obviously correct one on random inputs (stress testing).
Before you start. Python Basics: functions, loops, lists and range.