On Mon, Feb 24, 2020 at 3:01 PM Alex Hall <alex.mojaki@gmail.com> wrote:
Snip
From the assumptions in this scenario, we're talking about a beginner - specifically one who might have trouble understanding the kinds of things we're discussing, and who has never iterated over a string before (which, if I am to be generous to your side, is supposedly a common activity).
Context: I recall a conversation on the edu-sig group (Python in education) about teaching beginners. I was arguing that, when teaching in visual-based environment (think Karel the robot or the turtle module), when introducing loops, it would be useful to have something like "repeat n: move()" instead of "for irrelevant_name in range(n): move()". (This is something I have implemented in Reeborg's world and that has also been independently added in TygerJython) Someone (I believe it was Laura Creighton - sorry, I cannot find the link right now) mentioned that the very first example of loops they used was something like the following: for letter in "some word": print(letter) If I recall correctly, quite a few other people teaching beginners also mentioned that this was one of the first, if not the first example they used. In fact, I think I was in the minority in not using this type of iteration over strings as an early example of loops. So, I would argue that iterating over strings with beginners is something much more common than what you appear to believe. André Roberge