On Wednesday, September 12, 2012 3:11:42 PM UTC+2, Steven D'Aprano wrote: > On Wed, 12 Sep 2012 05:48:09 -0700, Libra wrote:
> > I need to implement a function that returns 1 only if all the values in > > a list satisfy given constraints (at least one constraint for each > > element in the list), and zero otherwise. > > What are the restrictions on the constraints themselves? > Could they be arbitrarily complicated? > "Item 2 must be an even number divisible by 17 and 39 with at least eight > digits but no greater than four million, unless today is Tuesday, in > which case it must be equal to six exactly." Generally the constraints are quite simple, like the one in my example. But I can also have 2 or more constraints for each value: L[0] >= 1 L[0] <= 5 To complicate a little, what about constraints like: L[0] + L[2] >= 3 Thanks > -- > > Steven -- http://mail.python.org/mailman/listinfo/python-list