Draw an ellipse given the length of x and y radii. If x and y are equal, a circle is drawn. The screen is set up to fit the proportion of the 320 x 220 screen. The vertical axis ranges from y = -44 to y = 44 while the horizontal axis ranges from x = -64 to x = 64. The ellipse is centered at (0,0).
from math import * from matplotlib.pyplot import * print("Draw an ellipse\nusing pyplot") a=eval(input("x axis? ")) b=eval(input("y axis? ")) # set axis axis((-64,64,-44,44)) # set points tl=[i/128*2*pi for i in range(129)] xl=[a*cos(i) for i in tl] yl=[b*sin(i) for i in tl] # draw the ellipse c='purple' plot(xl,yl,c) show()