what is it? Pascal | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is it? Pascal

a:array[0..1,0..6] of integer; I can’t understand how to correctly express it in python, help please 😣

13th Jun 2020, 3:10 PM
shiryaeva
shiryaeva - avatar
1 Answer
+ 4
Python does not limit arrays like Pascal or C++. They are always variable in size. Given you know C++, the equivalent is: int a[2][7]; However, Pascal can change the starting point to be non-zero such as 2..3 so, if converting, you must consider that. I would use this in Python: a=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]] It allocates and initializes the same data memory.
13th Jun 2020, 10:15 PM
John Wells
John Wells - avatar