[EMAIL PROTECTED] wrote: > Hi. I'm having another go at learning Python so I'll probably be > asking a few basic questions. Here is the first one. > > a = list(range(10, 21) > > b = 9 > > c = 21 > > How can I find out if b and c have values less or more than the values > in list a?
>>> a = range(10, 21) >>> b = 9 >>> c = 21 Are there any items in a that are less than b or greater than c? >>> any(x<b or x>c for x in a) False No. Are there any items in a that are greater than b? >>> any(x>b for x in a) True Yes. Peter -- http://mail.python.org/mailman/listinfo/python-list