IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Data Structures and Algorithms in Python

Visualizza il corso

Istruzioni dell'esercizio

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

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# 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.____()
Modifica ed esegui il codice