Logo

Programming-Idioms

History of Idiom 26 > diff from v61 to v62

Edit summary for version 62 by sgdpk:
[Python] Emphasize xrange is a Python 2.7 function

Version 61

2019-09-26, 18:44:20

Version 62

2019-09-27, 03:01:31

Idiom #26 Create a 2-dimensional array

Declare and initialize a matrix x having m rows and n columns, containing real numbers.

Illustration

Idiom #26 Create a 2-dimensional array

Declare and initialize a matrix x having m rows and n columns, containing real numbers.

Illustration
Code
x = [[0 for j in xrange(n)] for i in xrange(m)]
Code
x = [[0 for j in xrange(n)] for i in xrange(m)]
Comments bubble
Python 2.7
Origin
http://stackoverflow.com/a/6667288/871134
Origin
http://stackoverflow.com/a/6667288/871134