Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
106 views

This Assignment Has Three Parts. Part One

This document provides instructions for a three part programming assignment to create a picture using functions in Python Turtle Graphics. Part One involves writing pseudocode for the program. Part Two is coding the program, including comments and style guidelines. Part Three is completing a post mortem review answering questions about the program. The example output shows code for a program that defines functions to draw the features of a robot face and assigns them to a turtle to create the picture.

Uploaded by

Bob Smith
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views

This Assignment Has Three Parts. Part One

This document provides instructions for a three part programming assignment to create a picture using functions in Python Turtle Graphics. Part One involves writing pseudocode for the program. Part Two is coding the program, including comments and style guidelines. Part Three is completing a post mortem review answering questions about the program. The example output shows code for a program that defines functions to draw the features of a robot face and assigns them to a turtle to create the picture.

Uploaded by

Bob Smith
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 7

Name: Daniel Romanov 03.

04 Creating Functions

This assignment has three parts.

Part One: Write a program to draw a picture by defining functions and using Turtle Graphics. Use the
following guidelines to write your program.

1. Give your artwork a name. Print the name to the output.


2. Draw a picture using the turtle. You can pick the subject of your picture. Some suggestions
include a house, a car, a face, a robot.
3. At least two programmer-defined functions must be used.
4. The picture should include color.
Insert your pseudocode here:

def Main()
Define function for rectangles (door, windows)
Define function for sun (loop, fill)

Make rectangle
Make sun

Print “my house”

Main()

Part Two: Code the program. Use the following guidelines to code your program.

1. To code the program, use the Python IDLE.


2. Using comments, type a heading that includes your name, today’s date, and a short description
of the program.
3. Follow the Python style conventions regarding indentation and the use of white space to
improve readability.
4. Use meaningful variable names.

Example of expected output: The output for your program should resemble the following screen shot.
Your specific results will vary depending on the choices you make and the input provided.
#Daniel Romanov
#11/19/2020
#Use custom functions to draw a robot face

import turtle

def face (f):

f.penup()
f.setpos(0,0)
f.left(90)
f.pendown()

f.color("red")
f.begin_fill()
f.forward(250)
f.right(90)
f.forward(200)
f.right(90)
f.forward(250)
f.right(90)
f.forward(200)
f.right(90)
f.end_fill()

def eyes (e):

e.penup()
e.setpos(35,155)
e.left(0)
e.pendown()

e.color("blue")
e.begin_fill()
e.forward(60)
e.right(90)
e.forward(30)
e.right(90)
e.forward(60)
e.right(90)
e.forward(30)
e.right(90)
e.end_fill()

e.penup()
e.setpos(135,155)
e.left(0)
e.pendown()

e.color("blue")
e.begin_fill()
e.forward(60)
e.right(90)
e.forward(30)
e.right(90)
e.forward(60)
e.right(90)
e.forward(30)
e.right(90)
e.end_fill()

def eyeballs (b):

b.penup()
b.setpos(60,210)
b.left(0)
b.pendown()

b.color("black")
b.begin_fill()
b.forward(50)
b.right(90)
b.forward(20)
b.right(90)
b.forward(50)
b.right(90)
b.forward(20)
b.right(90)
b.end_fill()

b.penup()
b.setpos(160,210)
b.left(0)
b.pendown()

b.color("brown")
b.begin_fill()
b.forward(50)
b.right(90)
b.forward(20)
b.right(90)
b.forward(50)
b.right(90)
b.forward(20)
b.right(90)
b.end_fill()

def nose (n):

n.penup()
n.setpos(80,100)
n.left(270)
n.pendown()

n.color("pink")
n.begin_fill()
n.forward(40)
n.right(-120)
n.forward(40)
n.right(-120)
n.forward(40)
n.right(-120)
n.end_fill()

def mouth (m):

m.penup()
m.setpos(35,60)
m.left(270)
m.pendown()

m.color("light blue")
m.begin_fill()
m.forward(40)
m.right(270)
m.forward(125)
m.right(270)
m.forward(40)
m.right(270)
m.forward(125)
m.right(270)
m.end_fill()

def main():
jeff = turtle.Turtle()
jeff.speed(1000)

face(jeff)
eyes(jeff)
nose(jeff)
mouth(jeff)
eyeballs(jeff)

print ("Abstract Style Robot Head")


main()
Part Three: Complete the Post Mortem Review (PMR). Write thoughtful two to three sentence responses
to all the questions in the PMR chart.
Review Question Response
What was the purpose of your program? To draw a robot face

How could your program be useful in the real This program can lead to popular digital art
world?

What is a problem you ran into and how did you fix I add an issue with adding many turtles, so I just
it? assigned all functions to one singular turtle
Describe one thing you would do differently the Definitely make an object that will need less code
next time you write a program. and by extension take less time to code.

You might also like