Skip to content

Aug 21: Getting Started with Thonny

Learning Objectives

After today's class, you should be able to:

  • Open, edit, save, and run a program in Thonny.
  • Submit a homework exercise on Gradescope.
  • Ask and answer questions (later) on Piazza.

Lesson Outline

Welcome! [10 min]

  • Name tents; get to know other students at your table
  • About the course; introductions by professor and TA

Mini Lab [20 min]

  • Demonstration of Thonny Python IDE (see code below)
  • Walk-through of how to submit "Lab 0" on Gradescope

Getting Help [15 min]

  • Click the Piazza link in Canvas and set up your account
  • What questions do you have about the syllabus/course?

Wrap-Up [5 min]

  • Explanation of "your to-do list" below (rest of the week)

Your To-Do List

By the end of today

  • Pre-Survey: Please submit this "quiz" if you haven't already!

By the end of Thursday

By the end of Friday

Due Tuesday at 11pm

Example Code

Here is the solution for today's mini-lab. Notice how lines 1–6 are formatted. When you submit to Gradescope, always include (1) a short description, (2) your name, and (3) the date. These lines must be formatted exactly as shown.

hello_world.py
1
2
3
4
5
6
7
"""Exercise 0.1 Hello World.

Author: Chris Mayfield
Version: 08/21/2024
"""

print("Hello, World!")

Here is a more interesting example that uses turtle graphics. If you have time during/after class, try extending the following code to draw a picture. Check out Trinket's Visual Introduction to Python for ideas.

hello_turtle.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import turtle
import time

turtle.shape("turtle")
turtle.speed(1)
time.sleep(0.5)

turtle.penup()
turtle.forward(25)
turtle.write("Hello there!")
turtle.backward(25)