Blog Archive

Friday, September 21, 2012

Manipulating Sets of Repeating Numbers

>>> m=[1,2,3]
>>> m*3
[1, 2, 3, 1, 2, 3, 1, 2, 3]
>>> [m]*3
[[1, 2, 3], [1, 2, 3], [1, 2, 3]]
>>> 
>>> zero=[0]
>>> [zero*3]*4
[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]

No comments:

Post a Comment