Question: Create an empty stack and push the name J . R . R . Tolkien in as the first ( bottom )

Create an empty stack and push the name "J.R.R. Tolkien" in as the first ("bottom") element.
Read Print the contents of your stack; it's okay if it includes newline characters ("
") and the brackets Python uses when outputting lists.
One at a time, pop and output the three top names from the stack; this should remove those three names from the collection.
Push your own name into the stack.
Print the contents of the stack.
Steps for the queue:
Create a queue using the deque class covered in this module.
Push the name of a fictional character (from a book, movie, tv show, etc) into the queue; this name should go at the "back" of the queue as the newest addition (and would be the last name to be removed).
One at a time, push the names from the text file into your queue.
Print the contents of the queue; it's okay if it includes newline characters ("
") and the brackets Python uses when outputting lists.
One at time, pop and print the five oldest names in the queue; this will remove those names from the collection.
Push the name of a school teacher you liked into the "back" of the queue.
Push the name of a favorite actor or musical artist; this name should go at the "back" of the queue.
Print the contents of the queue; it's okay if it includes newline characters ("
") and the brackets Python uses when outputting lists.the text file and push each name onto the stack.
pip 8 python

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!