Open This Document
Link to this page: bit.ly/pyturt
Welcome and Introduction
I am Dave Briccetti (bri-’cheddy). I am a professional computer programmer who enjoys teaching programming to kids. I teach at three private schools, at the Lafayette Library occasionally, and I have individuals and small groups come to my house in Lafayette for lessons. (More)
When you follow links from this document, holding Shift and Cmd while you click will open the page in a new tab and switch to that tab.
Computer programs are instructions for getting a computer to perform a task, such as these:
- Send a text message
- Play a game
- Manage a calendar
- Drive a car
- Fly a spacecraft
Types of Computers
Programs run on computers of different sizes and types:
- Arduino and Raspberry Pi
Programs are written using programming languages. Some popular ones are:
About This Course
Python is a popular programming language, used by many, including Google and NASA.
Our classes consist of:
- Instruction (Lectures)
- Exercises, where you practice what you’ve just learned, with specific goals
- Creative project work, where you apply what you’ve learned in your own way
- Show and tell, where we share our interesting creations
I usually keep lectures to just a few minutes. During this time I need your focus and full attention. During exercises and creative work, I encourage you to interact with your classmates. Get up, walk around and see what others are doing. Sit where you want, rearranging any time. Just make sure RoomHelper 3000 (see below) knows where you are.
Many of your parents are likely excited about you learning programming at school. They will be curious about what we are doing. Please point them to this page, so they can follow along with us. Show them at home what you are learning in class. Explaining your programs to others can increase your understanding.
When You Finish
When you complete assigned work, there’s always more to do. You can
- Help others
- Read the reference and learn about more features
- Experiment, and make your own original creations
Let’s Get Started
Here’s a program to start with.
Run it. What things can you change?
Making a Square, the Long Way
from turtle import * fd(50) rt(90) fd(50) rt(90) fd(50) rt(90) fd(50) rt(90)
Loops and nested loops
You can repeat code by making a loop:
for n in range(10): loops 10 times, taking
n from 0 to 9
for x in range(-200, 201, 100): loops 5 times,
x from -200 to 200 in steps of 100
Making a Square a Better Way, Using a Loop
from turtle import * for n in range(4): fd(50) rt(360 / 4)
Grid of Circles
This program makes a grid of circles
Interactive Graphics with Keyboard Input
Let’s start with this sample.
You can use random numbers to affect your turtle graphics. Here’s a starting point.
Challenge: Make more things random
Make these things random:
- pen size
- line length
- Make the color random