On Thu, 05 Jun 2008 23:42:07 -0400, John Salerno wrote:

> Is it possible to write a list comprehension for this so as to produce a
> list of two-item tuples?
> 
> base_scores = range(8, 19)
> score_costs = [0, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3] print zip(base_scores,
> score_costs)
> 

score_costs = [(base_scores[i], score_costs[i]) for i in range (len 
(base_scores))]

But, I'd rather just use zip. :-)

-- 
code.py: A blog about life, the universe, and Python

http://pythonista.wordpress.com
** Posted from http://www.teranews.com **
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to