You are on page 1of 6

Name:Guillermo Kuljis

This assignment has three parts.


Part One: Programming

Write a program to move the Turtle based on the user’s request. Display a menu with options for the
user to choose. Use the following guidelines to write your program.

1. Create a menu that gives the user options for moving the Turtle. The menu should contain
letters or numbers that align with movements such as forward, backward, and/or drawing a
particular pattern.
2. Use at least one ​if-else​ or ​elif​ statement in this program. It should be used to move the
Turtle based on the user's input.
3. A loop is optional but may be used to ask the user to select multiple choices.
4. Use one color other than black.
5. Write the pseudocode for this program. Be sure to include any needed input, calculations,
and output.

Insert your pseudocode here:

Def.foward120

Def.right90-foward120-left90

Def.left90-foward120-right90

Def.Backwards-right180-foward120-right180

Def.red

Def.blue

Def.yellow

Def.green

Def.orange

Def.pink

Def.black

PrintType foward to draw fowards

Print Type backward to draw backwards

Print Type left to draw to the left.

Print Type right"" to draw to the right.

Print Type quit to finish your drawing

def main:
(j) = turtle.turtle
left90
speed5
colorblack
p-Try to draw a rectangle with the provided functions: foward, backward, left, right!")
p-When you input one of 4 functions, the arrow will go in the direction commanded to make a
short line.")
quit = 0
while quit
x = input first begin by chosing you color from the colors given,then place your direction in the
next question. There is red, blue, yellow, green, orange, pink and black
If x==left
goLeft
Elif x==right
goRight
elifxfoward
gofoward
elifbackward
gobackward
elifquit
quit=1
elifred
red
elifblue
blue
elifyellow
yellow
elifgreen
green
eliforange
orangej
elifpink
pink
elifblack
black
else:
Unknown function, please insert a function given
hideturtle
Thank you for your amazing drawing you have made cool work
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 variables names.

Example of expected output:​ The screen shot below is an example of a menu. Your specific
results will vary depending on the choices you make. This sample moves the turtle forward,
backward, left, or right based on user input of ​F​, ​B​, ​L​, or ​R​, which are the menu options. The user
inputs ​Q​ to quit.

Guillermo kuljis
2/20/2021
Create a program that allows users to move the turtle around

import turtle

def gofoward(u):
u.forward(120)

def goRight(u):
u.right(90)
u.forward(120)
u.left(90)

def goLeft(u):
u.left(90)
u.forward(120)
u.right(90)

def gobackward(u):
u.right(180)
u.forward(120)
u.right(180)
def red(u):
u.color("red")

def blue(u):
u.color("blue")

def yellow(u):
u.color("yellow")

def green(u):
u.color("green")

def orange(u):
u.color("orange")

def pink(u):
u.color("pink")

def black(u):
u.color("black")

def printMenu():
print("Type ""foward"" to draw fowards.")
print("Type ""backward"" to draw backwards.")
print("Type ""left"" to draw to the left.")
print("Type ""right"" to draw to the right.")
print("Type ""quit"" to finish your drawing.")

def main():
j = turtle.Turtle()
j.left(90)
j.speed(5)
j.color("black")
print("Try to draw a square with the provided functions: foward, backward, left, right!")
print("When you input one of 4 functions, the arrow will go in the direction commanded to make
a short line.")
quit = 0
while( quit != 1):
printMenu()
x = input("first begin by chosing you color from the colors given,then place your direction in
the next question. There is red, blue, yellow, green, orange, pink and black.)")
if(x=="left"):
goLeft(j)
elif(x=="right"):
goRight(j)
elif(x=="foward"):
gofoward(j)
elif(x=="backward"):
gobackward(j)
elif(x=="quit"):
quit=1
elif(x=="red"):
red(j)
elif(x=="blue"):
blue(j)
elif(x=="yellow"):
yellow(j)
elif(x=="green"):
green(j)
elif(x=="orange"):
orange(j)
elif(x=="pink"):
pink(j)
elif(x=="black"):
black(j)
else:
printUnknown function, please insert a function given
hideturtle
printThank you for your amazing drawing you have made cool work
Part Three: ​Post Mortem Review

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? Giving users a menu to allow them to move
foward,backward,left,and right to creat a
specific pattern such as a square

How could your program be useful in the real Making blue prints for buildings
world?
What is a problem you ran into, and how did I kept not defing my colors so i had to keep
you fix it? going back and define my colors.I woould also
forget to write my else sataments.

Describe one thing you would do differently I would use the if-else statment not elif.
the next time you write a program.

You might also like