Aan de slagGa gratis aan de slag

Using Python's LifoQueue

In this exercise, you will work with Python's LifoQueue(). You will create a stack called my_book_stack to add books and remove them from it.

Deze oefening maakt deel uit van de cursus

Data Structures and Algorithms in Python

Cursus bekijken

Oefeninstructies

  • Import the module that contains Python's LifoQueue().
  • Create an infinite LifoQueue().
  • Add an element to the stack.
  • Remove an element from the stack.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Import the module to work with Python's LifoQueue
import ____

# Create an infinite LifoQueue
my_book_stack = queue.____(____)

# Add an element to the stack
my_book_stack.____("Don Quixote")

# Remove an element from the stack
my_book_stack.____()
Code bewerken en uitvoeren