Module 11
Standard Library Power Tools
// Lessons
6
// Quiz questions
90
// Reading time
180 min
// Exam length
15 Q
// Coding exercises
10
- 1Regular Expression FundamentalsMatch character classes, set boundary anchors, and scan raw string patterns with re.search and re.match. 30 min 15 questions
- 2Advanced Regex & Group SubstitutionExtract structured data with named capture groups, replace substrings with re.sub, and use lookarounds. 30 min 15 questions
- 3Dates, Times & TimedeltasCalculate calendar intervals, extract timestamp components, and handle UTC timezone offsets. 30 min 15 questions
- 4Date Parsing & Formatting (strptime/strftime)Convert raw timestamp strings into datetime objects and format dates for localized user display. 30 min 15 questions
- 5Random Numbers & Cryptographic SecretsGenerate reproducible test distributions with random and produce secure tokens with the secrets module. 30 min 15 questions
- 6Math & Statistical ComputationsPerform precision math operations, analyze datasets with mean and median, and calculate variance. 30 min 15 questions
Coding practice: write it yourself
Real Python, real checks: write your answer, press Run checks, and keep going until it passes. (4 exercises)
Coding practice needs an account. Sign in or create a free ID to run these exercises.
Lab 1: Extract digits
Use re.findall(r"\d+", "Item 42 costs 150 taka"). Print the extracted list of digit strings: ['42', '150'].
Coding Practice is Locked
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and earn XP.
Lab 2: Days difference
Calculate the days between date(2026, 1, 1) and date(2026, 1, 10). Print: Days: 9.
Coding Practice is Locked
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and earn XP.
Lab 3: Sample without replacement
Set random.seed(5). Sample 2 items from ['cat', 'dog', 'bird', 'fish'] using random.sample(). Print: Sampled 2 items: True.
Coding Practice is Locked
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and earn XP.
Lab 4: Statistics mean
Compute the arithmetic mean of [10, 20, 30, 40] using statistics.mean(). Print: Average: 25.0.
Coding Practice is Locked
Sign in to access the interactive Python editor, write and run code checks against automated tests, use hints, and earn XP.
References & Further Reading
Related entries from PyLabs's own reference library.