Files, Exceptions, and Modules Python lessons
Reading and writing text data, handling predictable failures, imports, and safe input boundaries.
Core concepts
Problem-solving patterns
- text file · statistics
- csv · module
- logs · filtering
- replace · text processing
- try except · ZeroDivisionError
What this topic builds
Learn the idea once, trace it through two verified cases, then explain why your approach works.
All 10 lessons in this topic
Work from top to bottom to build each concept gradually.
- #067Count lines, words, and charactersStarterPremium
Compute basic statistics for text that could have been read from a file.
- #068Total values from CSV rowsStarterPremium
Calculate the total value of three CSV order rows.
- #069Extract error log entriesBeginnerPremium
Extract only ERROR records from a mixed log.
- #070Replace a word in textBeginnerPremium
Replace every old environment name in a line.
- #071Divide safely with exceptionsBeginnerPremium
Safely divide two valid numeric inputs.
- #072Validate integer inputBeginnerPremium
Accept a valid signed integer from a form field.
- #073Parse key-value configurationIntermediatePremium
Parse and alphabetize a small configuration block.
- #074Summarize JSON ordersIntermediatePremium
Summarize quantity and value from an API-style JSON response.
- #075Calculate days between datesIntermediatePremium
Find the number of days between project start and finish dates.
- #076Count file extensionsAdvancedPremium
Count extensions in a small project folder listing.