OK python 2 dimensional arrays (sorry i mean lists) are getting to me.
The code below will calculate the coordinates of the circumference of a circle in 0.1 degree steps. and i want to store it in a 2d array that ideally would have the index values 0,1,2,3... 3599, and each index position would contain the degree, and the x and y coordinate.
I get arrays in other languages but i know in python the syntax is different, and for some reason I just can't get my head around it. I have tried appending or as below trying to initialise the array, and always an error.
so
[0][0] = 0 degrees [0][1] = 2.0 [0][02] = 0
[1][0] = 0.1 degrees [1][1] = 1.99999695383 [1][2] = 0.0034906567318
Etc
I will need to do some more stuff with lists but at the moment just creating a 2D list both fully initialised and to be adjusted at run time would be a nice start. So if some one could correct the syntax on this for me and explain where I am wring I would be grateful.
Step = 0.1 #steps in degrees
diamator = 2 #diamator of the circle
degree = 0 # starting degreee
Circlearray=[3600][2]
#360 degrees devided by 0.1 (step) = 3600 so run the loop this many times
for num in range(0,3600):
#math functions work in rads so do the conversion
rad = degree * (math.pi/180)
#calculate the x,y cords for each value of degree
x = 2*math.cos(rad)
y = 2*math.sin(rad)
#incress degree by 0.1
degree = degree + Step
#save degree,x,y coordinates to array with a key of num
Circlearray[num][0] = degree