I need to write a Python Turtle graphics program to output an n-pointed regular star, where n is an odd integer from 5 -to- 99 input by the user in answer to a question prompt.

Also, my program should NOT contain separate code for each different star


please help! ASAP!!

Recommended Answers

All 2 Replies

Start with code to draw a line. Next add code to calculate the angle necessary to draw a star with a given number of points. A 5 pointed star would have 10 lines and the angle would be 72 degrees for example. You would then draw a line of a fixed length, starting at point x, y at the appropriate angle. Then starting where the previous line left off, draw another line of the same length at the given angle to that line. It might be easier to start with a triangle with all angles at 6o degrees and then adjust to drawing a star. It would be interesting to try, but I don't want to do your homework for you.

I need an algorithm that will write the 5 pointed, 7 pointed, 9 pointed, all the way to 99 pointed stars with out me writing a code for each star. Is there such an animal?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.