[Tutor] stopping a loop

Julieta Rangel julieta_rangel@hotmail.com
Sat, 05 May 2001 20:24:52 -0500


Are you implying a tripple nested loop?  meaning
for x in set:
    for y in set:
        for z in set:
           if ['x',('y','z')] == [('x','y'),'z']:
              return associativity holds

Is this what you mean?  If I give the computer those commands, will it look 
for the definition on my dictionary?  You see, I'm not sure how I'm supposed 
to tell the computer to look in the dictionary for these values and compare 
them.  Any more hints, ideas, suggestions, comments, questions?

Julieta

>From: "Tim Peters" <tim.one@home.com>
>Reply-To: <tutor@python.org>
>To: "Julieta Rangel" <julieta_rangel@hotmail.com>
>CC: <tutor@python.org>
>Subject: RE: [Tutor] stopping a loop
>Date: Sat, 5 May 2001 19:55:11 -0400
>
>[Julieta Rangel]
> > ...
> > Now I  have to check for associativity, and I'm trying to figure out
> > how I can do that.
> > ...
> > we can look for associativity by making all the possible combinations.
> > That is, verify that e*(e*e)=(e*e)*e, a*(e*e)=(a*e)*e, and so on.
>
>Here's a hint:  you want to verify that x*(y*z) == (x*y)*z for all x, y and 
>z
>in your set.  Earlier you wanted to build a table for all x and y in your
>set.  The latter involved two variables and was solved with a doubly-nested
>loop.  So the former, involving three variables, might be approached how?
>
>One more hint:  If x, y and z are elements of your set, then the result of
>x*(y*z) is spelled how?  Start with y*z:  that's
>
>     product[y, z]
>
>So x*(y*z) is
>
>     product[x, product[y, z]]
>
>and (x*y)*z is ...?
>
>you're-closer-than-you-know<wink>-ly y'rs  - tim
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com