Part One: Write a program to draw a picture by defining functions and using Turtle Graphics. Use the following guidelines to write your program.
Insert your pseudocode here:
Part Two: Code the program. Use the following guidelines to code your program..
1)
CODE
import turtle
def print_name():
t = turtle.Turtle()
t.penup()
t.setposition(0, 0)
t.pendown()
t.fillcolor("blue")
t.write("Sample programming")
def draw_hexagon():
polygon = turtle.Turtle()
polygon.penup()
polygon.setposition(150, 150)
polygon.pendown()
polygon.color("blue")
num_sides = 6
side_length = 70
angle = 360.0 / num_sides
for i in range(num_sides):
polygon.forward(side_length)
polygon.right(angle)
turtle.done()
def draw_star():
star = turtle.Turtle()
star.penup()
star.setposition(200, 200)
star.pendown()
star.color("green")
for i in range(5):
star.forward(50)
star.right(144)
turtle.done()
print_name()
draw_hexagon()
draw_star()
2)
CODE
# Name: Your name
# Today's date: 13th September, 2019
# Python code to sum the element of an array
lst = [1, 2, 3, 4, 5]
sum = 0
for i in lst:
sum += i
print (sum)
Get Answers For Free
Most questions answered within 1 hours.