what I was trying to do with that loop is check each character in the string against the corresponding character at the same position in the second string. rikart pointed out that my loop was actually checking if that character exists anywhere in the second string.
<br>basically, in pseudocode:<br><br>for thing in bunch of things<br> check to see if thing from bunch of things is present in second bunch of things<br><br>so "thing" here (called item in my original code) does not represent the index. it's just a counter for things.
<br>in java (which is the only language i am even kind of familar with) loops and iterators are different, and everything has to be defined...<br><br>rikart pointed out that you need to use a range to get to the indicies of the items in the string.
<br><br>for item in range(len(string))...<br> if word1[item] == word2[item]<br><br><br>and that's the fix. whether i am doing something totally weird, or that could be done a better way in python, i don't know...
<br><br><br>zannah<br><br><br><br><div><span class="gmail_quote">On 3/6/07, <b class="gmail_sendername">Alan Gauld</b> <<a href="mailto:alan.gauld@btinternet.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
alan.gauld@btinternet.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>"David Perlman" <<a href="mailto:dperlman@wisc.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">dperlman@wisc.edu</a>> wrote<br><br>> I can't figure out how this would ever work at all. It seems like
<br>> it's either checking to see whether boolean TRUE is in word2, or
<br>> else<br>> it's checking to see whether item is equal to boolean TRUE or FALSE,<br>> and neither of those should ever be true.<br><br>It's doing the latter and since anything that's not 'empty' in
<br>Python evaluates to true we wind up checking whether<br>true == (item in word)<br><br>So if the item is in word we get true == true which is true.<br><br>HTH,<br><br><br>--<br>Alan Gauld<br>Author of the Learn to Program web site
<br><a href="http://www.freenetpages.co.uk/hp/alan.gauld" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.freenetpages.co.uk/hp/alan.gauld</a><br><br><br>_______________________________________________
<br>Tutor maillist - <a href="mailto:Tutor@python.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://mail.python.org/mailman/listinfo/tutor</a><br></blockquote></div>
<br>