Maggie’s First Python Project

Maggie is taking her first computer science class this year. The seventh grade course meets every other day for half a block (45 minutes) during the first trimester. This isn’t a lot of time for learning and practice, but students usually dive in with gusto and Maggie is no exception. Although I do teach a section of the class, I don’t have Maggie. She’s with my brilliant colleague, Chris Collins.

At the mid point of the first trimester, we ask students to create a short project using the code that they’ve learned thus far. They are using the Python programming language. Here’s what Maggie created:

Maggie’s program uses the turtle to create a campsite scene.

To create this scene, Maggie wrote 170 lines of code using Python’s default text editor (known as IDLE). If you’re curious, the code is appended below.

#project1

import turtle
t = turtle.Pen()
t.speed(0)
t.screen.bgcolor("midnight blue")

#ground
t.width(10)
t.color("brown")
t.pu()
t.goto(-200, -161)
t.pd()
t.goto(200, -161)

#tree 1
t.pu()
t.width(7)
t.color("maroon")
t.goto(-190, -160)
t.pd()
t.goto(-190, -60)
t.color("forest green")
t.goto(-210, -90)
t.pu()
t.goto(-190, -60)
t.pd()
t.goto(-170, -90)
t.pu()
t.goto(-190, -80)
t.pd()
t.goto(-210, -110)
t.pu()
t.goto(-190, -80)
t.pd()
t.goto(-170, -110)
t.pu()
t.goto(-190, -100)
t.pd()
t.goto(-210, -130)
t.pu()
t.goto(-190, -100)
t.pd()
t.goto(-170, -130)
t.pu()

#tree 2
t.setheading(270)
t.pu()
t.fillcolor("green")
t.pencolor("darkgreen")
t.goto(100, -90)
t.pd()
t.begin_fill()
t.circle(30)
t.end_fill()
t.pu()
t.goto(120, -120)
t.pd()
t.pencolor("chocolate1")
t.fillcolor("burlywood1")
t.begin_fill()
t.forward(40)
t.left(90)
t.forward(20)
t.left(90)
t.forward(40)
t.end_fill()

#tent
t.fillcolor("purple1")
t.pu()
t.goto(-50, -160)
t.pd()
t.begin_fill()
t.color("purple1")
t.goto(40, -160)
t.goto(20, -110)
t.goto(-30, -110)
t.goto(-10, -160)
t.end_fill()
t.pu()
t.fillcolor("purple3")
t.begin_fill()
t.goto(-30, -110)
t.goto(-50, -160)
t.end_fill()
t.pu()
t.color("purple1")
t.goto(-33, -110)
t.pd()
t.goto(-53, -160)

#moon
t.pu()
t.goto(110, 50)
t.pd()
t.begin_fill()
t.color("old lace")
t.circle(50)
t.end_fill()

#stars
t.pu()
t.goto(220, 40)
t.pd()
t.color("lemon chiffon")
t.circle(2)
t.pu()
t.goto(220, 90)
t.pd()
t.circle(2)
t.pu()
t.goto(160, 90)
t.pd()
t.circle(2)
t.pu()
t.goto(40, 20)
t.pd()
t.circle(1)
t.pu()
t.goto(20, 20)
t.pd()
t.circle(2)
t.pu()
t.goto(0, 20)
t.pd()
t.circle(3)
t.pu()
t.goto(-130, 30)
t.pd()
t.circle(2)
t.pu()
t.goto(-40, 30)
t.pd()
t.circle(1)
t.pu()
t.goto(-40, 150)
t.pd()
t.circle(2)
t.pu()
t.goto(0, 150)
t.pd()
t.circle(1)
t.pu()
t.goto(0, 190)
t.pd()
t.circle(3)
t.pu()
t.goto(140, 190)
t.pd()
t.circle(2)
t.pu()
t.goto(-160, 130)
t.pd()
t.circle(1)
t.pu()
t.goto(220, 164)
t.pd()
t.circle(2)
t.pu()
t.goto(-220, 100)
t.pd()
t.circle(2)
t.pu()
t.goto(-80, -70)
t.pd()
t.circle(1)

t.hideturtle()

One thought on “Maggie’s First Python Project”

Leave a Reply

Your email address will not be published. Required fields are marked *