...

/

Challenge: Namedtuples, Stacks and Queues

Challenge: Namedtuples, Stacks and Queues

Test your understanding of namedtuples, stacks and queues with these coding questions.

We'll cover the following...

Problem 1

Task: Create a namedtuple called Task with fields id and name.

  1. Make a stack of 3 tasks.
  2. Pop one task from the stack.
  3. Print the popped task.
Python 3.10.4
from collections import namedtuple, deque
# Write your code here

Problem 2

You are given a set of tasks. Each task has three fields:

  • id (an integer ID)
  • name (a string description)
  • time (time in minutes)

You should:

  • Store all tasks in a queue
...