[Tutor] double ended queue
Alan Gauld
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':
break
elif response == 'r':
# remove right
elif response == '0r':
# remove left
else:
number = int(response) # or do we need float???
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list