Python Beginner Tutorial Lesson 1: Hello Python

Pre-class 5 min: Confirm three things

  1. Python 3.11+ is installed

  2. VS Code (or PyCharm Edu) has the Python extension installed

  3. GitHub account is registered and joined Classroom (the teacher sends an invitation link in advance)

Part A Theory 20% (15 min)

Using 3 very simple PPT slides:

  • Slide 1: A one-sentence summary of what Python can do—websites, automation, AI, Raspberry Pi, office scripts.

  • Slide 2: Interpreter vs IDE—open Notepad on-site to write a line of print, then open VS Code and press F5 to run the same line, allowing students to see the debug button.

  • Slide 3: Syntax of print and input—open the terminal and type in REPL:

    print(“Hello Python”)

Part B Hands-on 80% (65 min)

Step 1 Hello Script (5 min) Create a new file hello.py and enter:print(“Hello Python”) Right-click → Run Python File, the terminal displays Hello Python.

Step 2 Turtle Square (15 min) Create a new file turtle_square.py and type line by line:import turtle as tfor _ in range(4):t.forward(100)t.right(90)t.done() Explain import, for, range, forward, right line by line, students run it themselves, and a square appears in the window.

Step 3 Class Challenge: Draw a Red Star (30 min) Hint: The angle of the star is 144°, provide the template:import turtle as tt.color(‘red’)for _ in range(5):t.forward(100)t.right(144)t.done() Students type it themselves, and the teacher circulates to answer questions. Advanced: Change the color and side length to be input() from the user.

Step 4 First Debug (10 min) Intentionally write an error: t.right(“144”), let students see TypeError. Live demonstration: set a breakpoint on the left side of VS Code, execute line by line with F10, and observe the variable window.

Class Summary (5 min) Review the three essentials: REPL, script, debug button. Emphasize “write a line, run a line”.

Homework (to be completed in 10 min after class)

  1. Change the color of the star in turtle_star.py to red (already completed).

  2. Use input() to allow the user to input a color string, such as blue / green.

  3. Push to the GitHub Classroom repository, naming it: lesson1_turtle_star.py

  4. Add a line to README: Homework for Lesson 1—A little turtle that can draw a star.

Backup Plan (for computers without a graphical interface)

  • Use the official online Turtle simulator:

    https://colab.research.google.com/github/python/cpython/blob/main/Doc/includes/turtle-stars.ipynb
  • Or use a text version to print characters forming a “star”.

Next class preview: Variables and Basic Types—Write a “self-introduction generator”.

Leave a Comment