Is there a nice(r) way of creating a list of uniform values? I'm currently
using: list('0'*N), which makes a string and then chops it up into a list. I
need it to create a NxN matrix:
matrix =[list('0'*N) for i in range(N)]
(elements need to be mutable afterwards, a shallow copy is bad)
While this is short and concise, it also feels odd :)
using: list('0'*N), which makes a string and then chops it up into a list. I
need it to create a NxN matrix:
matrix =[list('0'*N) for i in range(N)]
(elements need to be mutable afterwards, a shallow copy is bad)
While this is short and concise, it also feels odd :)
Comment