Answered You can hire a professional tutor to get the answer.

QUESTION

So my professor asked us to program a "stick figure" in python turtle, which I did but my program is not working.

So my professor asked us to program a "stick figure" in python turtle, which I did but my program is not working. He wants us to repeat and/or randomize elements from the current "stick figure" program which I don't know how to do. The important thing is that the picture should look different each time you run it and there should be multiple components that change. The whole picture that you created as in turtle can repeat with different settings Parts of a big picture can repeat with different settings, e.g., the whole picture could represent a scene with different random elements. Etc. Like distance, color or position

import turtle

screen = turtle.screen()

screen.setup(500,500)

my_turtle = turtle.Turtle()

#function to draw circle head with radius 50

def draw_head():

 my_turtle.circle(50)

 my_turtle.right(90)

# function to draw torso, lift pen up, then move to middle of torso

def draw_torso():

 my_turtle.forward(150)

 my_turtle.pu()

 my_turtle.backward(75)

 my_turtle.right(135)

# function to put pen down, draw left arm at 45 degrees, then return to middle of torso

def draw_left_arm():

 my_turtle.pd()

 my_turtle.forward(50)

 my_turtle.right(45)

 my_turtle.forward(10)

 my_turtle.pu()

 my_turtle.backward(10)

 my_turtle.left(90)

 my_turtle.pd()

 my_turtle.forward(10)

 my_turtle.pd()

 my_turtle.forward(10)

 my_turtle.pu()

 my_turtle.backward(10)

 my_turtle.left(135)

 my_turtle.forward(50)

 my_turtle(90)

# function to put pen down, draw right arm at 45 degrees, return to middle of torso, turn right 135 dgrees to face down

def draw_right_arm():

 my_turtle.pd()

 my_turtle.forward(50)

 my_turtle.left(45)

 my_turtle.forward(10)

 my_turtle.pu()

 my_turtle.backward(10)

 my_turle.right(90)

 my_turtle.pu()

 my_turtle.backward(10)

 my_turlte.right(135)

 my_turtle.forward(50)

 my_turtle.left(45)

# function to move to bottom of torso, put pen down left leg at 45 dgrees facing, down then lift pen up

def draw_left_leg():

 my_turtle.forward(75)

 my_turtlel.right(45)

 my_turtle.pd()

 my_turtle.forward(50)

 my_turtle.pu()

 my_turtle.backward(50)

# function to return to bottom of torso, put pen down, draw right leg at 45 degrees facing down

def draw_right_leg():

 my_turtle.left(90)

 my_turtle.pd()

 my_turtle.foward(50)

#function that calls all of the above functions

def draw_stick_figure():

 draw_head()

 draw_torso()

 draw_left_arm()

 draw_right_arm()

 draw_left_leg()

 draw_right_leg()

draw_stick_figure()

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question