Python OPPE: Allowed Modules & How Hidden Test Cases Grade You
Two things fail more Python OPPE submissions than any algorithm: not knowing which modules are allowed, and misunderstanding how hidden test cases grade you. Get both right and a lot of "it worked for me" zeros disappear.
Which modules are allowed in the Python OPPE?
Only the Python standard library — there is no internet, no pip, and no third-party packages inside the proctored editor. In practice, plain built-in Python covers almost everything, and the two imports you'll actually reach for are:
import math—sqrt,gcd,factorial,ceil/floor,inf.import random— only if a question explicitly needs randomness (rare).
You do not need numpy or pandas for OPPE coding questions, and trying to import them will fail. If you forget a built-in's signature, help(name) and print(dir(obj)) work right inside the editor. Practise with just the standard library on the Python practice set so nothing surprises you on exam day.
How hidden test cases actually work
Your program is run against inputs you never see, and its printed output is compared, character for character, to the expected output. That's why correct logic still scores zero:
- Exact format — an extra space, a missing newline, wrong capitalisation, or printing
5.0when5was expected all fail. - Silent edge cases — empty input, a single element, zero, negative numbers, ties, and a trailing blank line in a file.
- No prompt text — never put a message inside
input(); print only what the question asks for.
Test yourself before you submit
Before submitting, feed your own extreme inputs: the empty case, the one-element case, the largest case. If the question says "print the numbers separated by a space," check there's no trailing space. This habit is the single biggest score-saver — rehearse it under a timer and see where you land on the leaderboard.
FAQ
Can I import collections or itertools? Yes — they're standard library. Anything shipped with Python is available; third-party packages are not.
Does output have to match exactly? Yes. Auto-grading is a string comparison, so format matters as much as logic.
Where do I practise this? On the Programming in Python practice page, with the official Python docs for reference.