

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 6
click for more info
Not enough gems
Cost: 6 gems
1: What Is a Queue?
incomplete
2: Queue Class
incomplete
3: Queue Speed
incomplete
4: Matchmaking Queue
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
In LockedIn, users that are founding companies can join a matchmaking queue to find potential co-founders for their projects. We'll use the Queue class we've built to manage the matchmaking process.
Notice the search_and_remove method on the Queue class (in queue.py). It breaks the rules of a traditional queue data structure but will be useful in solving this real-world problem.
It's okay to violate academic constraints as software engineers as long as we understand the trade-offs involved.
Complete the matchmake function that simulates users joining and leaving the matchmaking queue. The function should take a queue instance and a user tuple containing a name and action (either "join" or "leave"):
user = ("Bob", "join")
user = ("Alice", "leave")
For each call to matchmake:
"{user1} matched {user2}!"
Where user1 is the first user popped and user2 is the second user popped.