For Coursera, prepare one exercise where a result depends on explicit rules about a threshold, absent input and a tie. Then show how you would apply the same care to course progress.
What to prepare for Coursera
The Coursera bank contains plurality and runoff voting. Coursera also describes Specializations as sequences of related courses. Practise the bank's voting contract independently, then use the education context for a progress-state design. Coursera Specializations product explanation, Coursera employer site
Count plurality votes with explicit ties
Each valid ballot is one candidate ID. Return all candidates tied for highest votes in lexical order. Empty ballots produce an empty result. For a runoff extension specify which candidates advance and what happens to ballots with no remaining choice before implementing another count. PracHub practice question
from collections import Counter
def leaders(votes):
counts = Counter(votes)
best = max(counts.values(), default=0)
return sorted((key for key, n in counts.items() if n == best))
assert leaders(['b', 'a', 'b', 'a', 'c']) == ['a', 'b']
assert leaders(['b', 'a', 'b']) == ['b']
assert leaders([]) == []
Build a count map and return the highest-count keys. Expected counting time O(n), plus sorting the tied set. Storage O(candidates). A candidate-level tie is a result that needs a policy, so using the first key in insertion order creates an undocumented outcome.
Walk through a boundary case
A plurality count [B,A,B,A,C] returns both A and B. If only one progresses, the extra rule should define the tie before implementation. Then model a learning plan requiring A, B and C. Two completion events for A and one completion for B on an older version are only one completed item in the current plan. Both examples reward making the input set and threshold visible.
Count completion against an enrolled plan version
Keep the required modules and completion events versioned. A repeated event contributes only once. An unknown module or event on a different version cannot unlock the active certificate. Use the returned pair to display a denominator even when nothing has been completed.
def progress(required, events, version):
done = {module for v, module in events if v == version}
return (len(required & done), len(required))
assert progress({'a', 'b', 'c'}, [(1, 'a'), (1, 'a'), (2, 'b'), (1, 'unknown')], 1) == (1, 3)
assert progress({'a'}, [(2, 'a')], 1) == (0, 1)
Design and debugging follow-up
For a learning plan that requires modules A, B and C, a duplicate completion for A must never move the student to two-thirds. Key completions by learner, module and plan version. A learner on version 1 may still finish while version 2 is published. Show exactly which completion set a certificate request should read.
What to bring to a mock interview
Bring a fixture where a course is retired between enrollment and completion. Explain historical progress and what the current interface surfaces for the learner.