Re: Numbers in python

2006-03-10 Thread neildunn
If your still worried by using floats for your values you may wish to look into the decimal module: http://docs.python.org/lib/module-decimal.html Example: from decimal import Decimal Decimal(2) + Decimal('1.47') Decimal(3.47) Regards, Neil --

Nested list comprehensions

2005-11-26 Thread neildunn
Hey guys: [(i,j,k) for i in range(1,j) for j in range(1,k) for k in range(1,5)] [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 1, 4), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 2, 4), (1, 3, 1), (1, 3, 2), (1, 3, 3), (1, 3, 4), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 1, 4), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 2,