[Tutor] how to add string into the specified position of the
original string
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Sun Oct 24 02:44:28 CEST 2004
On Sun, 24 Oct 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"
Hi Lin,
This sounds slightly like a homework problem, so I'll have to be a little
vague.
Are you familiar with lists yet? If so, you may want to try converting
your string into a list of characters, and manipulate that.
See:
http://www.python.org/doc/lib/built-in-funcs.html#l2h-43
Good luck to you.
More information about the Tutor
mailing list