I have VBA function and I’m trying to convert this application in Python.
Now I need to translate the following VBA code:
Dim R_SH(1 To 3, 1 To 3) As Double
in Python.
I tried to write the following Python code but I think that is not correct:
w, h = 2, 3
R_SH = [[0 for x in range(w)] for y in range(h)]
Could we support me?
>Solution :
In Python, arrays are 0-indexed. They start from 0 not 1.
To create an equivalent VBA array R_SH(1 To 3, 1 To 3), you need to create a 3×3 array in Python.
At the moment you’re creating a 3×2 array, here’s how you create a 3×3 array:
w, h = 3, 3
R_SH = [[0 for x in range(w)] for y in range(h)]