How do you draw a star in Python, I am really confused over it now
This is the program I have so far

import helper
*helper checks if input is valid or not
import ecs10graphics07 as gr
* ecs10graphics07 is almost the same as the program Tkinter
import math

starPoints = raw_input ("Enter an odd integer:")
goodInput = helper.isFloat(starPoints)

if not goodInput:
print "Not a valid input."
raw_input ("Press enter to exit.")

winSize = 200

gr.begin_graphics(winSize,winSize,background = gr.Color.purple,title="me")


radius = 200
center = [250,250]
angle = 0

while angle < 2.0*math.pi:

x = center[0] + radius*math.cos(angle)
y = center[1] + radius*math.sin(angle)
point = [x,y]
print point
angle = angle + 25

raw_input("Enter to exi")

I think I see what you are doing.
Your angle is too small (and in the wrong units).

Consider, if you want a 5-pointed star: 360 /5 = 72, so each point is 72 degrees apart.
BUT you want to draw a line to every other point, so you will have to make the angle 72 * 2 = 144 degrees.

Since you are using radians, thats 2 * pi / 5 * 2 = 2.5133 radians.

Also, you will go around the circle twice, so you should make your loop a for loop counting how many points have been drawn.

When thinking about these sort of things, it really does help to get out a piece of paper and pencil and draw what is happening.

Hope this helps.

for vpython using python 2.5.1 you just need to make a list of 5 cones :)

angle = 90 #you can start where ever depending on how many sides you want
point = {}
for x in range(0,5,1):
    point[x] = cone(pos = (0,26,0),axis = (2.*cos(angle*pi/180),2.*sin(angle*pi/180),0), radius = 0.5, color = color.yellow)
    angle += 72 #angle/number of sides
This article has been dead for over six months. Start a new discussion instead.