python - cutting a trapezium (or whatever) in multiple pieces of same size -


i using python @ moment, don't what's wrong code:

from sympy.solvers import solve sympy import symbol  x = symbol('x') xpos = list([]) in range(6):     xp = solve(6*x+22/32*x**2-544/6*(i+1),x)     xpos.append(xp) xpos1 = list([])     in range(len(xpos)):     xpos1.append(xpos[i][1]) 

it should give me list x positions cut trapezium pieces of same size... problem list xpos1 first created empty list , deleted within last line of code. when change last line to

xpos1.append(xpos[i]) 

xpos1 created (as copy of xpos, of course). wrong code, don't it?

thanks in advance

try printing out variable before script terminates:

from sympy.solvers import solve sympy import symbol  x = symbol('x') xpos = list([]) in range(6):     xp = solve(6*x+22/32*x**2-544/6*(i+1),x)     xpos.append(xp) xpos1 = list([])     in range(len(xpos)):     xpos1.append(xpos[i][1])  print(xpos1) 

that way see contents of list.


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -