On 7/5/2010 8:31 AM prasad rao said...
hi
   I am trying problem 6 in projecteuler.org.
What is the smallest positive number that is evenly divisible by all
of the numbers from 1 to 20?


def rr(z,m=1):
           q=lambda n:m%n==0
           s=lambda False : 0
           a=filter(s,map(q,range(1,z)))
           if not a:
               m+=1
               rr(z,m)
           else:return m

This code is going into endless loop.


You don't show us how you're invoking this function, but it seems to me the result of passing a terminally false function result (s is always false) into filter will always result in [] (so a is always false) and will thereby cause the else clause never to be reached.

Emile


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to