Re: [Tutor] finding numbers in range of of numbers

2008-10-21 Thread Kent Johnson
On Tue, Oct 21, 2008 at 2:26 PM, Richard Lovely <[EMAIL PROTECTED]> wrote: > I felt I need to appolgise for my first post in this thread... I don't know why... > I don't have internet access, and I've yet to find a public computer > with Python, so I'm unable to test any code I write. I'm going

Re: [Tutor] finding numbers in range of of numbers

2008-10-21 Thread Richard Lovely
I felt I need to appolgise for my first post in this thread... I don't have internet access, and I've yet to find a public computer with Python, so I'm unable to test any code I write. I'm going have to discpline myself not to post to here unless its: a) a problem of my own, or b) an answer that

Re: [Tutor] finding numbers in range of of numbers

2008-10-21 Thread Kent Johnson
On Tue, Oct 21, 2008 at 10:43 AM, bob gailer <[EMAIL PROTECTED]> wrote: > I would make a copy of each list; take a pass thru each copy, convert the > strings to integers and reverse the descending pairs. > > a1 = [['xa', 1511255, 1511279],['xb', 7516599, 7516623],['xc', 98356266, > 98356290]] > >

Re: [Tutor] finding numbers in range of of numbers

2008-10-21 Thread ALAN GAULD
a = [['xa','1511255', '1511279'],['xb','7516599','7516623'],['xc','98356290','98356266']] b = [['G1','1511200','1511325'],['G2','7516500','7516625'],['G3','98356335','98356126']] >>> for item1 in a: ... i1st = int(item1[1]) ... i1en = int(item1[2]) ... for item2 in b: ...

Re: [Tutor] finding numbers in range of of numbers

2008-10-21 Thread bob gailer
Srinivas Iyyer wrote: Dear Alan and tutors, I apologize for careless description of my problem that lead to confusion. the problem arises due to large range of numbers and range has direction (both ascending and descending). I am giving an example from my real problem. What I want to do

Re: [Tutor] finding numbers in range of of numbers

2008-10-21 Thread Srinivas Iyyer
1255 1511279 G1 1511200 1511325 xb 7516599 7516623 G2 7516500 7516625 xc 9835629098356266G3 9835633598356126 Issue 1: a. Range of numbers is too high and xrange is also too slow. I used xrange instead of range - a slow process Issue 2: Is

Re: [Tutor] finding numbers in range of of numbers

2008-10-21 Thread Kent Johnson
On Tue, Oct 21, 2008 at 8:47 AM, Richard Lovely <[EMAIL PROTECTED]> wrote: > Guessing you mean [5,100] as the inclusive interval notation, so all > but the last element of the example pass? > > if any(True for x, y in listoflists if 5 <= x and y <= 100): > #do stuff or if any((5 <= x and y <= 10

Re: [Tutor] finding numbers in range of of numbers

2008-10-21 Thread Richard Lovely
Guessing you mean [5,100] as the inclusive interval notation, so all but the last element of the example pass? if any(True for x, y in listoflists if 5 <= x and y <= 100): #do stuff does this do it for you? Or if you want to know if any elements of the lists within the larger list are within

Re: [Tutor] finding numbers in range of of numbers

2008-10-21 Thread Alan Gauld
"Srinivas Iyyer" <[EMAIL PROTECTED]> wrote [[10,45],[14,23],[39,73],[92,135]] I want to identify if any of the items in this list are in range of [5,100] Sorry, I have no idea what you mean by that. Can you give an example of passing and failing tests? For example do any/all of the elements

Re: [Tutor] finding numbers in range of of numbers

2008-10-20 Thread W W
On Mon, Oct 20, 2008 at 5:19 PM, Srinivas Iyyer <[EMAIL PROTECTED]>wrote: > dear group, > a simple question that often challenges me. > > I have > > I have a list of list: > > [[10,45],[14,23],[39,73],[92,135]] > > I want to identify if any of the items in this list are in range of [5,100] > > The

[Tutor] finding numbers in range of of numbers

2008-10-20 Thread Srinivas Iyyer
dear group, a simple question that often challenges me. I have I have a list of list: [[10,45],[14,23],[39,73],[92,135]] I want to identify if any of the items in this list are in range of [5,100] These numbers are large in original data, I will be using xrange for memory issues. thank