[Tutor] double ended queue
atuxnull at gmail.com
Sun Nov 5 10:05:04 EST 2017
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'?
On Sun, Nov 5, 2017 at 11:27 AM, Steven D'Aprano <steve at pearwood.info>
> On Sun, Nov 05, 2017 at 10:07:31AM +0200, Atux Atux wrote:
> > Hi. Thanks a lot for the replies. i am actually nw to programming as
> > your code keeps asking the user for a number and puts it to the end. how
> > can i make it to add a number at the beginning if the user adds 01, then
> > the program it will strip 0 and add 1 at ythe beginning, please?
> This sounds like homework. We don't do people's homework for them. What
> have you tried?
> Hint: how to tell whether a string ends with "01" or not.
> if the_string.endswith("01"):
> print("insert the_string at the beginning")
> print("append the_string at the end")
> Second hint. Try running this in the Python interpreter and see what it
> the_string = "1234501"
> the_string = the_string[:-2]
> Third hint: I already showed you how to insert at the beginning, or
> append at the end, of the queue.
> We can provide you the pieces of the puzzle, but you have to put them
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
More information about the Tutor