We’re switching to a slower format of blog posts: one per
three weeks, rather than one a week.
That should make it easier to come up with enough material to write
about.
Our topic has slid into the Finch robots last week. The Finches are round, wheeled vehicles that
look like they were made by Apple. One
can program them using Python. In our
case, the Finches’ utility was severely hurt by the fact that they kept getting
stuck and slipping on the floor. So the
first program we put into the Finches, though theoretically perfect, was in
practice useless. I was absent for the
second.
In addition, the Finches used Python, but were not
programmed via IDLE- one had to use a separate interface, JES. The result was almost a shorter repeat of the
Jeroo unit in how disconnected our work was from the general Python course. Also, we worked with partners, which- though
useful- was also fiddly. In sum, the
Finches didn’t work particularly well.
The Finches were last week; this week belonged to
strings. Strings are a type of variable,
basically a list of characters. If a
string variable is named, for instance, “hippo”, then hippo[x] will retrieve
the character directly after the xth character in the “hippo” string. (Thus, hippo[0] indicates the first letter of
hippo.) The other particularly useful
command is “for x in hippo”. This runs
through a function of x for every x that is a character in hippo.
Strings are, in a sense, immutable. There is no way to change a string, one
character at a time, except by saying something like “hippo = hippo.Replace(1,a)”. I haven’t actually used this function, but
apparently it exists; and the fact that one can do stuff like simulating a
Caesar code shows that, really, strings are just a bit trickier to change, not
completely immutable. In most cases. I have no doubt that some part of the
restriction on string alterations has, in the past, caused advanced students to
curse the day Python was invented.