[Tutor] how to add string into the specified position of the original string

Lloyd Hugh Allen chandrakirti at gmail.com
Sun Oct 24 02:54:38 CEST 2004


Be aware that your input uses 0 (zero) and your output has capital
letter "o". People don't always notice that, but computers will get
angry.


On Sat, 23 Oct 2004 18:43:26 -0600, Bob Gailer <bgailer at alum.rpi.edu> wrote:
> At 06:32 PM 10/23/2004, Lin Jin wrote:
> >if i define a function:
> >def setposition(post,outter,string):
> >
> >i want to call the function setposition(3,"S", "0S0 0SSSS") that return
> >the"OSOSOSSSS"
> >HOW COULD I DEFINE THE FUNCTION TO MAKE THAT.THX
> 
> I can't determine the desired behavior from the example. Please explain.
> The closest I can imagine is that you want to replace the character in
> position post with outter. The names make it a little hard to understand,
> and how/why do the zeroes get replaced with ohs?
> 
> 
> Bob Gailer
> bgailer at alum.rpi.edu
> 303 442 2625 home
> 720 938 2625 cell 
> 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list