Paul's Python CoursePPC

Project 7 of 9, for Yahya

University and Interview Readiness

Yahya's timed paper of six first-year problems, from the Workshop to the Puzzle Room, then practice at explaining your own work out loud, as a university interview or a job interview would ask.

About 3 hours, in 14 steps.

Sign up free to open itLog in

Act 9 needs a free account, so your work is saved as you go. Act 1 is open to everyone.

The brief

  • YahyaIt's six first-year questions in a hundred and fifty minutes, and I did it in ninety-four.
  • PaulUniversities ask two things of you, and so do interviews. It happens to be the same two.
  • PaulSolving something you've never seen against a clock, and then explaining something you built, clearly.
  • CaitlinI'll just do the questions in order, it's the quickest way through.
  • YahyaRead them all first, and then we can talk about quickest.

Two parts, and a clock in the top bar that counts your time against 150 minutes. Nothing happens when it runs out.

The paper. Six questions from the Workshop to the Puzzle Room, at the level of a first-year exam. Each is one function in its own file, checked by hidden tests: empty input, one item, duplicates, and inputs big enough that a slow answer runs out of time.

  1. first_error(text): the first bracket that doesn't match.
  2. winner(ballots): the winning print in an exhibition's vote, with a fair tie-break.
  3. round_order(parcels): a courier's round, sorted three ways at once.
  4. count_pairs(prices, target): a slow function, made fast.
  5. bank_sizes(chart): the sandbanks on a chart of the estuary.
  6. smallest_limit(crates, days): the lightest load limit that gets a ferry's crates across in time.

The interview. Three questions about work you've shipped, each with Paul's own answer to set beside yours. Then a practice interview, out loud, against Paul's list.

What it prints
>>> first_error("[lamp(on]")
8
>>> winner(["Gull", "Tern", "Gull"])
'Gull'
>>> smallest_limit([4, 8, 3, 5, 6], 3)
11

What you learn

What's in it

  1. Before the clock
  2. Binary search on the answer
  3. Question 1: The clock's lamp schedule
  4. Question 2: The poster vote
  5. Question 3: The courier's round
  6. Question 4: Two for a pound
  7. Question 5: Sandbanks at low water
  8. Question 6: The ferry's load limit
  9. Interview: a decision
  10. Interview: ten times as many
  11. Interview: a bug you found
  12. Practice interview
  13. Ship it