Logo

Programming-Idioms

History of Idiom 26 > diff from v67 to v68

Edit summary for version 68 by programming-idioms.org:
[Python] Comment: xrange doesn't exist in Python 3.

Version 67

2020-03-14, 00:42:13

Version 68

2020-03-16, 17:25:16

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
Comments bubble
Python 2.7

xrange doesn't exist in Python 3.
Origin
http://stackoverflow.com/a/6667288/871134
Origin
http://stackoverflow.com/a/6667288/871134