[Tutor] double ended queue

Atux Atux atuxnull at gmail.com
Sat Nov 4 16:11:08 EDT 2017


i am new to the area and i am struggling with a small project that i have.
i need some help please. i need to create a program that runs constantly
unless the user presses q to end it. the program asks the user for a number
and puts the number in a queue, then it prints the queue with the new
element at the end.if the number is with 01,02 then it will be added at the
left hand side without the 0 at the beginning, otherwise at the right hand
side. the user can remove an item from the end of the queue by typing r. if
the user types '0r' it will be removed from the beginning of the queue.

i got the starting point where it asks the user and goes until 'q' is
pressed.

while True:
    if input("\n\n\nType  a number to add it to the queue or q to
exit: ") == 'q':
        break

but i a stuck on how to continue asking and adding to the list


More information about the Tutor mailing list