As usual, create a directory to hold today's files. All programs that you write today should be stored in this directory.
$ cd ~/cs120/labs $ mkdir lab1 $ cd lab1
Write a Python program that uses turtle graphics to draw a diamond.
Write a Python program that uses turtle graphics to draw a square that is centered in the window.
One of the first shapes you learned to draw in grade school was probably a star. It is a pretty easy shape to draw, looks pretty cool, and can be done entirely with straight lines. The only tricky part is determining how to go from one point of the star to the next. Today, you will figure that part out.
In Emacs, create a Python program in a file called star.py. Your program should use the turtle module to draw a five-pointed star.
$ python3 star.py
turtle.forward
and
either turtle.left
or turtle.right
.
Use
the turtle.circle
function to draw a pentagram like the following:
One of the great advantages to using a computer for drawing is that it is possible to draw precisely. It makes creating something perfectly symmetrical very easy.
In Emacs, create a Python program in a file called house.py. Your program should use the turtle module to draw a simple house. The house should be a square with a triangle for a roof, and a rectangle for a door. The house should be symmetrical about a vertical line.
$ python3 house.py
Spruce up the house. Add things like a chimney, the sun, a tree, a mailbox, a fence, whatever you want, as long as it impresses me.