Re: Create dictionary based of x items per key from two lists

2015-02-02 Thread rajanbond
On Saturday, 31 January 2015 18:39:01 UTC-8, Jason Friedman wrote: > > I have two lists > > > > l1 = ["a","b","c","d","e","f","g","h","i","j"] > > l2 = ["aR","bR","cR"] > > > > l2 will always be smaller or equal to l1 > > > > numL1PerL2 = len(l1)/len(l2) > > > > I want to create a dictionary that

Re: Create dictionary based of x items per key from two lists

2015-02-02 Thread rajanbond
On Saturday, 31 January 2015 18:39:01 UTC-8, Jason Friedman wrote: > > I have two lists > > > > l1 = ["a","b","c","d","e","f","g","h","i","j"] > > l2 = ["aR","bR","cR"] > > > > l2 will always be smaller or equal to l1 > > > > numL1PerL2 = len(l1)/len(l2) > > > > I want to create a dictionary that

Re: Create dictionary based of x items per key from two lists

2015-02-01 Thread Chris Angelico
On Mon, Feb 2, 2015 at 6:36 AM, Ian Kelly wrote: >> At long last my quest seeking the final entry for the Zen of Python is over. >> I'll be delighted to let you accept the honour of raising an issue on the >> bug tracker to get the "this" module changed to reflect my new found wisdom. > > And whil

Re: Create dictionary based of x items per key from two lists

2015-02-01 Thread Mark Lawrence
On 01/02/2015 19:36, Ian Kelly wrote: On Sun, Feb 1, 2015 at 11:49 AM, Mark Lawrence wrote: On 01/02/2015 18:14, Grant Edwards wrote: A loop containing 1 line of code will execute in the same abount of time as that loop with 1 line of code and 99 blanks lines. The latter loop is running at 10

Re: Create dictionary based of x items per key from two lists

2015-02-01 Thread Ian Kelly
On Sun, Feb 1, 2015 at 11:49 AM, Mark Lawrence wrote: > On 01/02/2015 18:14, Grant Edwards wrote: >> A loop containing 1 line of code will execute in the same abount of >> time as that loop with 1 line of code and 99 blanks lines. >> >> The latter loop is running at 100 times as many lines/second

Re: Create dictionary based of x items per key from two lists

2015-02-01 Thread mm0fmf
On 01/02/2015 18:14, Grant Edwards wrote: No, you've got that backwards. You want_more_ blank lines. A blank line takes zero time to run, but it still counts as a line in your lines/second stats. You want more blanks lines to satisfy bean counting managers who want you to report "number of l

Re: Create dictionary based of x items per key from two lists

2015-02-01 Thread Ian Kelly
On Sat, Jan 31, 2015 at 7:38 PM, Jason Friedman wrote: >> I have two lists >> >> l1 = ["a","b","c","d","e","f","g","h","i","j"] >> l2 = ["aR","bR","cR"] >> >> l2 will always be smaller or equal to l1 >> >> numL1PerL2 = len(l1)/len(l2) >> >> I want to create a dictionary that has key from l1 and v

Re: Create dictionary based of x items per key from two lists

2015-02-01 Thread Mark Lawrence
On 01/02/2015 18:14, Grant Edwards wrote: On 2015-02-01, Chris Angelico wrote: On Sun, Feb 1, 2015 at 2:06 PM, Mark Lawrence wrote: The one-liner might not be better code, but it must be better speed wise precisely because it's on one line, right? :) Well of course it is. Python code speed

Re: Create dictionary based of x items per key from two lists

2015-02-01 Thread Grant Edwards
On 2015-02-01, Chris Angelico wrote: > On Sun, Feb 1, 2015 at 2:06 PM, Mark Lawrence wrote: >> The one-liner might not be better code, but it must be better speed wise >> precisely because it's on one line, right? :) > > Well of course it is. Python code speed is always measured in lines > per mi

Re: Create dictionary based of x items per key from two lists

2015-01-31 Thread Chris Angelico
On Sun, Feb 1, 2015 at 2:06 PM, Mark Lawrence wrote: > The one-liner might not be better code, but it must be better speed wise > precisely because it's on one line, right? :) Well of course it is. Python code speed is always measured in lines per minute. That's why you should eliminate blank lin

Re: Create dictionary based of x items per key from two lists

2015-01-31 Thread Mark Lawrence
On 31/01/2015 02:38, Chris Angelico wrote: On Sat, Jan 31, 2015 at 1:27 PM, wrote: l1 = ["a","b","c","d","e","f","g","h","i","j"] l2 = ["aR","bR","cR"] l2 will always be smaller or equal to l1 numL1PerL2 = len(l1)/len(l2) I want to create a dictionary that has key from l1 and value from l2

Re: Create dictionary based of x items per key from two lists

2015-01-31 Thread Jason Friedman
> I have two lists > > l1 = ["a","b","c","d","e","f","g","h","i","j"] > l2 = ["aR","bR","cR"] > > l2 will always be smaller or equal to l1 > > numL1PerL2 = len(l1)/len(l2) > > I want to create a dictionary that has key from l1 and value from l2 based on > numL1PerL2 > > So > > { > a:aR, > b:aR, >

Re: Create dictionary based of x items per key from two lists

2015-01-30 Thread Chris Angelico
On Sat, Jan 31, 2015 at 1:27 PM, wrote: > l1 = ["a","b","c","d","e","f","g","h","i","j"] > l2 = ["aR","bR","cR"] > > l2 will always be smaller or equal to l1 > > numL1PerL2 = len(l1)/len(l2) > > I want to create a dictionary that has key from l1 and value from l2 based on > numL1PerL2 > > So >

Create dictionary based of x items per key from two lists

2015-01-30 Thread rajanbond
I have two lists l1 = ["a","b","c","d","e","f","g","h","i","j"] l2 = ["aR","bR","cR"] l2 will always be smaller or equal to l1 numL1PerL2 = len(l1)/len(l2) I want to create a dictionary that has key from l1 and value from l2 based on numL1PerL2 So { a:aR, b:aR, c:aR, d:bR, e:bR, f:bR, g:cR