0% found this document useful (0 votes)
1K views4 pages

Name: Daniel Romanov 04.02 More Decisions: This Assignment Has Three Parts. Part One: Programming

This document outlines an assignment with three parts: 1) Write a Python program to move a turtle based on user input using menus and conditionals, 2) Code the program, and 3) Complete a post-mortem review. Pseudocode is provided for a program that displays a menu, defines movement functions, and uses a loop to repeatedly get user input and move the turtle. Sample code is given that implements the pseudocode and moves a turtle forward, backward, left, or right based on user key presses. Students are asked to code their own program and answer reflective questions in a post-mortem review.

Uploaded by

Bob Smith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views4 pages

Name: Daniel Romanov 04.02 More Decisions: This Assignment Has Three Parts. Part One: Programming

This document outlines an assignment with three parts: 1) Write a Python program to move a turtle based on user input using menus and conditionals, 2) Code the program, and 3) Complete a post-mortem review. Pseudocode is provided for a program that displays a menu, defines movement functions, and uses a loop to repeatedly get user input and move the turtle. Sample code is given that implements the pseudocode and moves a turtle forward, backward, left, or right based on user key presses. Students are asked to code their own program and answer reflective questions in a post-mortem review.

Uploaded by

Bob Smith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 4

Name: Daniel Romanov 04.

02 More Decisions

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 main()
Menu print user function options

Function definitions

Turtle loop

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 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.
Insert your program code here:

import turtle

t = turtle.Turtle()
t.penup()
t.setposition(100, 100)
t.pendown()
t.color("blue")
t.circle(50)

ben = turtle.Turtle()
ben.penup()
ben.setposition(-100, -100)
ben.pendown()
ben.shape("turtle")
ben.color("green")

def printMenu():
""" This function prints the menu to the screen """
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("~ How to Naviagte Turtle to Pond")
print("~ F: Up")
print("~ L: Left")
print("~ B: Down")
print("~ R: Right")
print("~ Q: Quit")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

def main():

choice = "-1"

while(choice != "q"):
printMenu()
choice = input("Look at the movement guide. In which direction would you like to move in? F,
B, L, or R. Select Q to exit. (make sure to type in lowercase)")

if(choice == "f"):
ben.setheading(90)
ben.forward(50)
elif(choice == "l"):
ben.setheading(180)
ben.forward(50)
elif(choice == "b"):
ben.setheading(270)
ben.forward(50)
elif(choice == "r"):
ben.setheading(0)
ben.forward(50)
elif(choice == "q"):
print("Thank you!")
else:
print("Oops, an invalid option was picked. Please try again.")

main()

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? To move a turtle to a set location based on user input.

How could your program be useful in This program could be used to move a variety of things.
the real world?

What is a problem you ran into, and how A problem I ran into was figuring out how to implement user
did you fix it? key interaction into the program. I solved it by using an
example found in the lesson.

Describe one thing you would do I would make the program more direct, so that you would not
differently the next time you write a be interrupted by the query box and would be able to control
program. the turtle using direct commands.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy