Wmo & Co
 
python
20150206

The beauty of python

Who needs Haskell or any other fp language when you have set comprehension in Python ?

n=48
{ (x,y) for x in range(1,1+int(math.sqrt(n))) for y in range(1,1+n) if (x*y)==n }


{(1, 48), (2, 24), (3, 16), (4, 12), (6, 8)}

 
Notes by Willem Moors. Generated on nini:/home/willem/sync/20140923_blog at 2018-06-16 11:17