larry priceSat May 12 00:08:04 PDT 2007
given a list of positive integers and a limit value return a list in which all values greater than the limit are set to the limit. here's what I came up with >>> n [1, 1, 1, 21, 2, 3, 4, 5, 55, 100, 99, 1005, 111, 11, 101] >>> z = [(lambda x: x if x <100 else 100)(i) for i in n] >>> z [1, 1, 1, 21, 2, 3, 4, 5, 55, 100, 99, 100, 100, 11, 100] >>> is there a more elegant way to phrase that?