PCEP study plan
PCEP · Give each week a clear focus.
8 weeks · About 6 hours per week
Computer Programming and Python Fundamentals & Data Collections: Lists, Tuples, Sets, Dictionaries, and Strings
Write and run 20 short scripts mixing int, float, bool and str literals with + - * / // % **, predicting every result before execution and logging any mismatch.
Convert values between int, float, str and bool, and state which values are falsy (0, 0.0, '', [], (), {}, None, False).
Build a single-file script that reads two values with input(), casts them, and prints a formatted result using print() with sep and end arguments.
Complete 30 index and slice predictions on lists and strings, including negative indices, step values and out-of-range cases, marking which raise IndexError.
Identify and fix 10 deliberately broken snippets involving unterminated strings, wrong indentation and mismatched operators.
Your checkpoint
One commented .py file containing the 30 index/slice predictions with predicted vs actual output, plus a 10-entry error log naming each exception type you triggered and its cause.
Data Collections: Lists, Tuples, Sets, Dictionaries, and Strings
Apply list methods append, insert, extend, remove, pop, sort, reverse, index and count across 20 scenarios, stating for each whether the method mutates in place or returns a new object.
Demonstrate aliasing versus copying by writing snippets using b = a, a[:], list(a) and a.copy(), and showing where a shared reference changes observable behavior.
Build a word-frequency counter over a 300-word text using a dictionary with get, setdefault, keys, values, items, update and pop.
Use at least 15 string methods (split, join, strip, replace, find, rfind, startswith, endswith, upper, lower, isdigit, isalpha, isspace, title, center) and slice strings with negative steps.
Solve three deduplication and overlap problems with set operators | & - ^ and explain why a set cannot contain a list.
Pack and unpack tuples in assignment, function returns and swap statements, and explain why tuple immutability prevents item assignment.
Your checkpoint
A 60-question self-made collections quiz with answer key, scored at 80% or higher, plus a one-page cheat sheet classifying every method you used as in-place versus returning a new object.
Control Flow: Conditional Blocks and Loops
Write 20 if/elif/else blocks covering comparison chaining, in, not in, is, is not and truthiness, predicting the branch taken before running each one.
Trace short-circuit evaluation of and, or and not across 15 expressions that call side-effecting functions, recording exactly which calls execute.
Rewrite 10 nested if statements as flat elif chains or conditional expressions and justify each rewrite.
Diagnose 10 snippets that raise IndentationError or SyntaxError, fix them, and state the PEP 8 rule that was violated.
Your checkpoint
Hand-drawn decision trees for five branching problems, plus a 30-question conditional quiz scored at 85% or higher with every miss re-explained in writing.
Control Flow: Conditional Blocks and Loops
Write for loops over range() with start, stop and step, and over strings, lists and dictionaries (keys, values, items), stating the iteration order for each.
Use while loops for eight accumulating and searching tasks, and write down the exact condition that terminates each loop.
Control loop flow with break, continue and the loop else clause across 12 exercises, predicting whether else executes in each case.
Build a nested-loop multiplication table and a pattern printer, then rewrite the multiplication table using a single loop.
Debug five infinite loops by adding a counter, a state print or a corrected condition.
Your checkpoint
A timed 45-minute set of 12 loop tasks that all run correctly, plus a written trace table for five tricky break/else cases showing each iteration's variable values.
Functions and Exceptions
Define and call 20 functions covering positional arguments, keyword arguments and default values, including a demonstration of the mutable default argument trap.
Explain return semantics by writing functions with no return, an early return, and a return of multiple values as a tuple.
Trace name resolution across 12 nested-scope snippets using the local, enclosing, global, built-in order, then rewrite one using the global keyword and argue why that is usually avoidable.
Write five recursive functions (factorial, Fibonacci, digit sum, list length, binary search) and print the recursion depth for each.
Your checkpoint
A small module of 10 documented functions plus a separate test script that prints expected versus actual for 15 cases and finishes with a pass count.
Functions and Exceptions
Use try/except/else/finally in 12 snippets and predict exactly which blocks execute for success, handled error and unhandled error outcomes.
Catch specific exceptions (ValueError, ZeroDivisionError, TypeError, KeyError, IndexError, FileNotFoundError) instead of a bare except, and justify each choice.
Raise and re-raise exceptions with raise, and validate inputs with assert while noting that the -O flag disables assertions.
Place 10 built-in exceptions into the standard hierarchy and state which base class a broad handler should target.
Your checkpoint
A crash-proof input-validation function that handles bad input gracefully, accompanied by a 20-case test matrix listing the exception type, message and recovery path for each case.
File Handling and Module Imports
Open, read (read, readline, readlines), write and append text files in modes 'r', 'w', 'a', 'r+', 'rb', predicting file contents after each operation and verifying with a hex or repr dump.
Refactor eight file snippets to use the with statement so files close even when an exception is raised, and confirm closure by inspecting the file object.
Import modules with import x, from x import y and import x as z, and use functions from math, random and platform in 10 working snippets.
Diagnose six runtime failures involving FileNotFoundError, ModuleNotFoundError, a wrong open mode and a file used after close.
Your checkpoint
A command-line program that reads a text file, counts characters, words and lines, and writes a formatted report file, plus a table of 10 file-mode outcomes you verified empirically.
Computer Programming and Python Fundamentals & Control Flow: Conditional Blocks and Loops & Data Collections: Lists, Tuples, Sets, Dictionaries, and Strings & Functions and Exceptions & File Handling and Module Imports
Re-attempt every entry in your error log and confirm each mistake is now explainable in one sentence.
Complete two 45-question timed mocks spanning all five domains and score 85% or higher on both.
Drill the 20 weakest objectives surfaced by the mocks until each is answered correctly twice in a row without notes.
Compress operator precedence, mutable versus immutable types, and the exception hierarchy onto a single reference page you can redraw from memory.
Your checkpoint
Two timed mock scores at 85% or higher, a one-page final cheat sheet, and a ranked list of remaining weak spots with a fix for each.
Milestones
Week 2: Without notes, correctly predict the output of 20 mixed list, string, tuple, set and dict operations, including method return values and mutation side effects, scoring at least 80%.
Week 4: Score 80% or higher on a 40-question, 50-minute mock covering domains 1, 2 and 3, with every wrong answer rewritten as a corrected snippet in your error log.
Week 6: Write from scratch, in under 20 minutes, a function that validates user input using try/except/else/finally and raise, then demonstrate it surviving five different bad inputs without crashing.
Week 8: Pass two full timed mocks at 85% or higher with no domain below 70%, and explain aloud the cause of every error you made in week 1.