On Mar 5, 1:34 pm, "Matimus" <[EMAIL PROTECTED]> wrote:
> On Mar 5, 11:03 am, "Steven W. Orr" <[EMAIL PROTECTED]> wrote:
>
> > I have a list ll of intergers. I want to see if each number in ll is
> > within the range of 0..maxnum
>
> > I can write it but I was wondering if there's a better way to do it?
>
> > TIA
>
> > --
> > Time flies like the wind. Fruit flies like a banana. Stranger things have  
> > .0.
> > happened but none stranger than this. Does your driver's license say Organ 
> > ..0
> > Donor?Black holes are where God divided by zero. Listen to me! We are all- 
> > 000
> > individuals! What if this weren't a hypothetical question?
> > steveo at syslang.net
>
> I would probably do something using max and min functions like this:
>
> seq = [...] # your list
>
> if min(seq) >= 0 && max(seq) <= MAXNUM:
>  do stuff

OOps... I've been writing too much C++ lately (or too little python).
That should read:

if min(seq) >= 0 and max(seq) <= MAXNUM:
    do_stuff()

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to