← back to unit
Easy
# queues easy
Whose Dish Night?
The chore wheel repeats forever: night 1 is the first name, night 2 the second… and after the last name it wraps around. 🍽️
You get the names and a night number n (could be night 1000!). Print whose turn it is — no loops needed if you know the remainder trick.
Example:
Input: names = ["mia", "leo", "kai"], n = 5
Output: leo
Night n belongs to position (n - 1) % len(names) = 4 % 3 = 1, which is leo.
💡 need a hint?
q-dish-night.py🔒 given lines are locked — write your code in between
loading...