[Tutor] trouble with function-- trying to check differences btwn 2 strings
rikard.bosnjakovic at gmail.com
Tue Mar 6 00:13:59 CET 2007
On 3/6/07, zannah marsh <zannah.m at gmail.com> wrote:
> if item == item in word2: #checks characters against each other
Here's the error.
Loop variable "item" contains the actual character in word1. The
syntax "item in word2" checks if this character is _anywhere_ in
word2. What you want to do is rewriting this loop so it checks
character per character. Since it's for homework, I don't want to ruin
your grades by giving you a solution. Try it yourself first.
To see what I mean, try running getDiff("abcd", "dcba").
More information about the Tutor