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 well.
> 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")
else:
    print("append the_string at the end")


Second hint. Try running this in the Python interpreter and see what it 
does:

the_string = "1234501"
the_string = the_string[:-2]
print(the_string)


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 
together.



-- 
Steve

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to