[Tutor] double ended queue
alan.gauld at yahoo.co.uk
Sun Nov 5 13:44:27 EST 2017
On 05/11/17 15:05, Atux Atux wrote:
> ok then. how do i link 'r' to remove an item from right with mylist.pop(0)
> and how can i remove an item from left with '0r'?
Same way you detected the 'q' to quit.
Using a variation of the 'code' I sent earlier:
response = input(....).lower() # allow user some latitude
if response == 'q':
elif response == 'r':
# remove right
elif response == '0r':
# remove left
number = int(response) # or do we need float???
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:
More information about the Tutor