Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Translate VBA function in Python

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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)]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading