On Dec 8, 11:44 am, "[EMAIL PROTECTED]" <[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? > > Thanks.
what about: a = list(range(10, 21)) def compare(value, list): m,M = min(list), max(list) return value>=m, value<=M b = 9 c = 21 print compare(b,a) print compare(c,a) for i in range (8, 25): print i, compare(i, a) """ (False, True) (True, False) 8 (False, True) 9 (False, True) 10 (True, True) 11 (True, True) 12 (True, True) 13 (True, True) 14 (True, True) 15 (True, True) 16 (True, True) 17 (True, True) 18 (True, True) 19 (True, True) 20 (True, True) 21 (True, False) 22 (True, False) 23 (True, False) 24 (True, False) """ it helps? -- http://mail.python.org/mailman/listinfo/python-list