MONT 105S, Spring 2009
Home | | Course Schedule | | Assignments | | Lecture NotesLaboratory 2
Due at the end of today's class
Problem #1.
Write a Python program that asks the user for a size and uses a turtle
to draw a square with a side length of that size.
To use a turtle, first import the turtle class using the line:
Next you should prompt for and read in the size of the square.
Next, create a turtle object using the statement:
Problem #2.
Write a Python program that asks the user if they want to draw an X or an O.
If the user enters "X", your program should use a turtle object to draw an X.
If the user enters "O", your program should use a turtle object to draw an O.
If the user enters anything else, your program should print:
The following Python code will draw an X:
yertle.up( )
yertle.goto(-50, 50)
yertle.down( )
yertle.right(45)
yertle.forward(141)
yertle.up( )
yertle.goto(-50, -50)
yertle.down( )
yertle.left(90)
yertle.forward(141)
The following Python code will draw an O:
yertle.up( )
yertle.goto(0, -50)
yertle.down( )
yertle.circle(50)
Use a conditional to determine what to draw.
What To Turn In.
A printed listing of each lab program.
Be sure that your name is in the program prologue's comment section of EACH program.
Reminder.
Be sure to save a copy of each program on your P:\ drive.
You are responsible for keeping a copy of every program until the graded assignment is handed back.