Question

write a non pure function (procedure) named drawstar that atkes no arguments and draws a 5...

write a non pure function (procedure) named drawstar that atkes no arguments and draws a 5 pointed star using python turtle graphics :

the drawsar procedure should do the following :

open a turtle dialogue box and have the user enter the length of each side.

draw a five pointed star with each side length as entered by the user. (hint: the internal angle of each points is 36 degrees)

to be honest, i really want to know how to do this on my own so if anybody could guide me it would be great. I am really stuck on the difference between pure function and non pure functions and also assign the side length to the user input box, which is the turtle.numinput() command i believe. PLEASE help and please try to explain..

Homework Answers

Answer #1

Answer

#using turtle graphics , draw the five point star without lines inside

#import turtle module

import turtle

#definition of Star for draw the star without

#inside lines

def Star(size):

    #angle define

    angle =120

    #for five sides

    for eachside in range(5):

        #forward direction

        turtle.forward(size)

        #right side

        turtle.right(angle)

        #forward direction

        turtle.forward(size)

        #right side

        turtle.right (72-angle)

    return

#method call here

#size passed through the method

Star(100)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT