0
I need to get coordenadas cartesianas
and separate them so that you know what the ordered pair is. I receive a string
where the dots come this way: x0,y0 x1,y1 ... xn,yn
I used a array split
by space first and then an array by commas, the problem is that the way I did is only storing the valor do primeiro par ordenado
. I need to use while/for
to traverse the entire array so that it doesn’t matter the amount of points typed
Code:
pontos=vetor.split(' ')
while(cont<(2*len(pontos))):
cord.append(0)
cont=cont+1
cont=0
while(i<len(pontos)):
p=(pontos[i].split(',')
while(len(p)>cont):
cord[cont]=p[cont]
cord[cont+1]=p[cont+1]
cord=cord+1
i=i+1
p=[]