Challenge
Shift rota
…work. In turn Build rota , a list of (day, shift, name) tuples for every shift of the week, in order, taking the crew in turn. Print one line per day, then count how many times one person works two…
Showing 11–20 of 28
Challenge
…work. In turn Build rota , a list of (day, shift, name) tuples for every shift of the week, in order, taking the crew in turn. Print one line per day, then count how many times one person works two…
Challenge
…10.5 min 12:50:00-13:02:45 Toruń 12.8 min Because each tuple starts with the start time, windows.sort() puts them in time order. {start:%H:%M:%S} formats just the time. The longest silence Find the…
Challenge
The monitoring system raises the same alert over and over. Group repeats of an alert that come within 60 seconds of the first into one line with a count, in the order they first appeared, then add the…
Challenge
Extend the working cargo console: record every change to the hold in a history list and show it with a history command, then add undo, which takes the last change off the history and reverses it.
Challenge
Write convert(), which looks a unit pair up in a table of factors, works the other way round by dividing, and refuses unknown units or missing pairs with a clear ValueError, then extend the table with…
Challenge
Move a 3D distance calculation that is copied for three waypoints into distance_km(a, b), keeping the output exactly the same, then put the waypoints in a dict and find the nearest one with the same…
Quiz
…*args and **kwargs: 15 questions on extra arguments, tuples, dictionaries, and * and ** in calls. Instant answers.
Example
Function can return multiple values as a tuple. Unpacking on assignment.
Example
Operator * allows accepting any number of positional arguments.
Quiz
…this one, try the Python Functions Quiz or the Python Tuples Quiz .