We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Matchmaking Queue

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.

Assignment

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.