PCEP Certified Entry-Level Python Programmer (PCEP-30-03): Exam Prep
Prepare for the PCEP-30-03 exam: read and trace Python code, predict output, and handle data collections, functions, exceptions, files and the math and random modules.
What you will learn
- Describe the PCEP-30-03 exam and explain how Python code is structured, interpreted and named (keywords, indentation, literals, variables)
- Evaluate expressions with arithmetic, string, relational and Boolean operators, and use print(), input() and type conversion
- Trace conditional blocks and while/for loops, including range(), nested loops, break, continue and pass
- Create, index, slice, copy and modify lists, tuples and sets, including nested lists
- Work with dictionaries and strings, using string methods and f-string, format() and % formatting
- Define and call functions with all argument types, predict scope, and handle exceptions with try/except
- Read, write and append text and CSV files, and import modules to use math and random functions
Modules
- The PCEP exam and Python fundamentals
- Operators, expressions and console I/O
- Control flow: conditions and loops
- Lists, tuples and sets
- Dictionaries, strings and formatting
- Functions, scope and exceptions
- Files and module imports
Course facts
- Level
- Exam preparation
- Estimated study time
- about 2 hours
- Final assessment
- 42 questions · Pass mark 70%
- Available in
- English, Français, العربية
- Price
- Free. Optional verifiable certificate: $5
- Last updated
- Published by
- AMAADOR ACADEMY
Who this course is for
Students, career changers, data and IT beginners, and professionals who want an entry-level Python certificate and need structured practice before booking the PCEP exam.
Prerequisites
No prior certificate. You should have written a few small Python programs; access to Python 3 on a computer helps you test the examples.
Course content
1. The PCEP exam and Python fundamentals
PCEP (Certified Entry-Level Python Programmer) is the first certificate of the Python Institute, run by OpenEDG. In November 2026 the Python Institute's own PCEP page and syllabus page describe the current exam version PCEP-30-03 (blueprint version 1.5, last revised 2 November 2026). This course teaches that version only.
| Item | PCEP-30-03 (official syllabus page) |
|---|---|
| Questions | 35 |
| Time | 50 minutes |
| Passing score | 70% |
| Item types | Single-select, multiple-select, interactive and scenario-based |
| Section | Questions | Weight |
|---|---|---|
| 1. Computer programming and Python fundamentals | 6 | 17% |
| 2. Control flow: conditional blocks and loops | 8 | 23% |
| 3. Data collections: lists, tuples, sets, dictionaries, strings | 9 | 26% |
| 4. Functions and exceptions | 7 | 20% |
| 5. File handling and module imports | 5 | 14% |
Source: pythoninstitute.org/pcep and pythoninstitute.org/pcep-exam-syllabus, checked 18 November 2026. The Python Institute’s PCEP-30-02 page (pythoninstitute.org/pcep-30-02) says PCEP-30-03 was released on 31 October 2026 and that PCEP-30-02 stays available until its sunset date, 30 November 2027. Price and exam languages are not stated on these pages, so check them in the OpenEDG store when you book.
What changed compared with earlier versions: sets, the walrus operator, CSV files and the math and random modules are now in the syllabus. Section 5 is new.
2. Operators, expressions and console I/O
Most section 1 questions ask you to evaluate one expression exactly. Learn these results by heart.
| Expression | Result | Why |
|---|---|---|
| 7 / 2 | 3.5 | / always returns a float |
| 6 / 2 | 3.0 | still a float |
| 7 // 2 | 3 | floor division |
| -7 // 2 | -4 | rounds down, towards minus infinity |
| 7 % 3 | 1 | remainder |
| -7 % 3 | 2 | result takes the sign of the divisor |
| 7.0 // 2 | 3.0 | a float operand gives a float |
| 2 ** 3 ** 2 | 512 | ** is right-associative: 3 ** 2 first |
| -2 ** 2 | -4 | ** binds tighter than unary minus |
| 'ab' * 3 | 'ababab' | string replication |
| '4' + '2' | '42' | string concatenation |
- ** (right to left)
- unary + and -
- * / // % (left to right)
- + -
- comparisons == != > >= < <=
- not, then and, then or
Compound assignment operators (+=, -=, *=, /=, //=, %=, **=) update a variable in place: after x = 5 and x //= 2, x is 2.
and and or short-circuit and return one of their operands, not necessarily True or False: 0 or 5 gives 5, 3 and 0 gives 0. not always returns a bool. Comparisons can be chained: 1 < x < 10 means 1 < x and x < 10.
3. Control flow: conditions and loops
An if block runs only when its condition is truthy. elif adds more conditions, and else catches everything left. In an if-elif-else chain, Python tests the conditions from top to bottom and runs only the first branch that matches; the rest are skipped.
score = 85
if score >= 50:
print('pass')
elif score >= 80:
print('merit')
else:
print('fail')
This prints only pass. The elif branch is unreachable for any score of 80 or more, because the first condition already caught it. The fix is to test the most specific condition first (>= 80, then >= 50).
| Situation | What happens |
|---|---|
| Several separate if statements | Each one is tested; several can run |
| One if-elif-elif chain | At most one branch runs |
| Chain with else | Exactly one branch runs |
| Condition is 0, '', [], None | Treated as False |
Compound conditions combine tests with and, or, not. Remember the order: not first, then and, then or. So a or b and c means a or (b and c). Nested conditions put an if inside another if; the inner one is tested only when the outer one is true.
4. Lists, tuples and sets
A list is an ordered, mutable collection: nums = [10, 20, 30, 40, 50]. Indexes start at 0; negative indexes count from the end.
| Expression | Result |
|---|---|
| nums[0], nums[-1] | 10, 50 |
| nums[1:3] | [20, 30] (stop excluded) |
| nums[:2], nums[3:] | [10, 20], [40, 50] |
| nums[::2] | [10, 30, 50] |
| nums[::-1] | [50, 40, 30, 20, 10] |
| nums[2:99] | [30, 40, 50] (slices never raise IndexError) |
| nums[5] | IndexError |
| len(nums), 30 in nums | 5, True |
Copying: b = nums does not copy; both names point to the same list, so b.append(60) also changes nums. A real (shallow) copy is nums[:], list(nums) or nums.copy().
| Operation | Effect |
|---|---|
| append(x) | adds x at the end |
| insert(i, x) | inserts x before index i |
| index(x) | position of the first x; ValueError if absent |
| remove(x) | deletes the first x; ValueError if absent |
| del nums[i], del nums[1:3] | deletes by position or slice |
| sorted(nums) | returns a new sorted list; nums is unchanged |
| nums.sort() | sorts in place and returns None |
Remember: x = nums.sort() leaves x equal to None. Methods that change a list in place (append, insert, remove, sort) return None.
5. Dictionaries, strings and formatting
A dictionary maps unique keys to values: stock = {'pens': 40, 'files': 12}. Since Python 3.7, dictionaries keep the order in which keys were inserted. Keys must be immutable (str, int, tuple); values can be anything.
| Code | Result |
|---|---|
| stock['pens'] | 40 |
| stock['ink'] | KeyError |
| stock.get('ink') | None, no error |
| stock.get('ink', 0) | 0 (the default you give) |
| stock['ink'] = 5 | adds a new key |
| stock['pens'] = 35 | updates an existing key |
| del stock['files'] | removes the key; KeyError if missing |
| stock.pop('pens') | removes the key and returns its value |
| 'pens' in stock | tests the keys, not the values |
| {'a': 1, 'a': 2} | {'a': 2}: the last duplicate wins |
Views: keys(), values() and items() give views you can loop over. items() produces (key, value) tuples, so you can unpack them:
for name, qty in stock.items():
print(name, qty)
A plain for k in stock loops over the keys. len(stock) counts key-value pairs. Values can be lists or other dictionaries, so you may see nested access such as staff['ops']['lead'].
Do
- Use get() when a key may be missing
- Use items() when you need both key and value
6. Functions, scope and exceptions
A function is defined with def, a name, parameters in brackets and a colon. Its body is indented. The function must be defined before the line that calls it runs; calling it earlier raises NameError.
def area(w, h):
return w * h
print(area(3, 4))
This prints 12. return ends the function immediately and sends a value back to the caller. Any line after return in the same block never runs.
| Function body | What the caller receives |
|---|---|
| return w * h | the product |
| return (no value) | None |
| no return statement at all | None |
| return a, b | a tuple (a, b), which can be unpacked: x, y = f() |
| print(w * h) only | the value is shown on screen, but the caller gets None |
Do
- return a value when the caller needs to use it
- Call a function with brackets: area(3, 4)
Don't
- Confuse print() inside a function with return
- Forget the brackets: print(area) shows the function object, not a result
A classic exam trap: def f(): print('A') followed by x = f() and print(x). The output is A on the first line and None on the second, because f prints and then returns nothing.
7. Files and module imports
Section 5 is new in PCEP-30-03. It starts with open(name, mode), which returns a file object.
| Mode | Meaning | If the file does not exist | If it exists |
|---|---|---|---|
| 'r' (default) | read | FileNotFoundError | reads from the start |
| 'w' | write | creates it | erases its content first |
| 'a' | append | creates it | adds at the end |
Always prefer the with statement: the file is closed automatically when the block ends, even if an exception occurs.
with open('log.txt', 'a') as f:
f.write('check OK\n')
| Call | Returns |
|---|---|
| f.read() | the whole file as one string |
| f.readline() | the next line, including its '\n'; '' at the end of the file |
| f.readlines() | a list of all lines |
| for line in f: | one line per pass, with its '\n' |
| f.write(text) | the number of characters written; no newline is added |
Do
- Use line.strip() to remove the trailing newline
- Write str(value) for numbers: f.write(5) raises TypeError
Don't
- Open an existing report in 'w' when you meant to add to it
- Read from a file after the with block has closed it (ValueError)
Remember: 'w' truncates, 'a' appends, 'r' fails if the file is missing. Writing to a file opened with 'r' raises io.UnsupportedOperation.
The full lesson continues in the interactive course on this page.
Sources and references
- PCEP – Certified Entry-Level Python Programmer (certification page)
- PCEP-30-03 exam syllabus, blueprint v1.5
- The Python Tutorial (official documentation)
- Built-in Exceptions
- csv — CSV File Reading and Writing
- math and random modules (standard library)
- PEP 8 – Style Guide for Python Code
Unofficial practice course. Not affiliated with, endorsed by or sponsored by the Python Institute or OpenEDG. PCEP is a trademark of its owner. Check the current exam outline on the Python Institute's website before you book.
All courses · Data Engineering & Analytics — Free certified training | AMAADOR ACADEMY