Dec-24-2016, 10:44 AM
New to python - just installed python3/ktinter in ubuntu/lubuntu system.
Been through a lot of tutorials etc but none of them explain in practical terms how to populate lists to resemble a two-dimensional array. (They usually show a few keyed lists then all the slicing etc stuff to manipulate these lists not how to use a loop to get the data INTO the lists).
I have a suite of stats software written in QB64 that I'm going to reprogram over time into python3.
In these I would do something like:
dim myArray(10,20)
for x=1 to 10
for y=1 to 20
let myArray(x,y)=(x-y) 'populate array with data using a formula
next y
next x
for x=1 to 10
for y=1 to 20
print myArray(x,y) 'output contents - could also be print to file
next y
next x
All my stuff will be 2-dimensional. (installed numpy but will probably avoid using)
All the other functionality I need to use python to re-write my software looks covered and there is so much good, compact stuff I can use. But none of the tutorial material I've seen covers the simple populate/print/save arrays functionality above.
An example of how to deal with this would be appreciated.
Been through a lot of tutorials etc but none of them explain in practical terms how to populate lists to resemble a two-dimensional array. (They usually show a few keyed lists then all the slicing etc stuff to manipulate these lists not how to use a loop to get the data INTO the lists).
I have a suite of stats software written in QB64 that I'm going to reprogram over time into python3.
In these I would do something like:
dim myArray(10,20)
for x=1 to 10
for y=1 to 20
let myArray(x,y)=(x-y) 'populate array with data using a formula
next y
next x
for x=1 to 10
for y=1 to 20
print myArray(x,y) 'output contents - could also be print to file
next y
next x
All my stuff will be 2-dimensional. (installed numpy but will probably avoid using)
All the other functionality I need to use python to re-write my software looks covered and there is so much good, compact stuff I can use. But none of the tutorial material I've seen covers the simple populate/print/save arrays functionality above.
An example of how to deal with this would be appreciated.