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

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sun Oct 24 03:01:33 CEST 2004

[Forwarding to tutor at python.org]

Hi Lin,

Thanks for being truthful.

Since this is defintely homework, we can't give you an "answer".  We're
restricted to gently point you in a direction that should help you on your
way.  But other than that, you have to do your work: we will not do your
homework for you.

What you need to solve that problem is pretty straightforward.  In
particular, you'll want to read about list and string manipulation.

You may find the following tutorials useful:


If you go through one of the tutorials there, you should be able to figure
out how to define setPosition().

If you have questions on tutorial material, please feel free to ask us
about it on the Tutor list.  Again, we can't give homework answers, but we
can clarify points that are confusing to you.

Good luck.

---------- Forwarded message ----------
Date: Sun, 24 Oct 2004 08:49:44 +0800
From: Lin Jin <jinlin555 at msn.com>
To: dyoo at hkn.eecs.berkeley.edu
Subject: Re: [Tutor] how to add string into the specified position of the
    original string

the question is like this:
  Create a function called setPosition which takes the marks data
structure, sets the the particular position (character 0 to 8 of the
string) to the given player's mark symbol (X or O). This function should
return this modified marks data structure.
For example, the function call=A1=AD

setPosition(0, "X", " OOXOXO X")
=A1=AD should return "XOOXOXO X": the original marks string with position z=
set to X

More information about the Tutor mailing list