Skip to content

First Python Program

Every programmer's first program prints two words and does nothing useful. It's a tradition, and we're not going to break it. From there we'll add a couple of variables and a little math, and you'll have written and run real Python.


Overview

We'll build this program together — I'll write it on the projector and talk through each line while you follow along on your own machine. Along the way you'll start the programming environment, create and save a Python script file, run it, and use variables with different data types.

How this one works

This is a follow-along lab. We write it as a class, one line at a time, on the projector. Keep pace, and stop me with questions — that's the point.

You've got it when…

  • Your program prints Hello, World!.
  • It prints your name and a fun fact about you.
  • It stores a number in a variable and prints it.
  • It prints the result of a calculation using that number.

Collaboration & AI

Work: Together as a class, then finish and save your own copy.

AI — AIAS Level 1, No AI: This is your first program; type every line yourself. What the levels mean.


Your Program

Write a program that:

  • Prints Hello, World!.
  • Prints your name and a fun fact about yourself.
  • Stores your age (or another number, like a favorite number) in a variable and prints it.
  • Prints the result of a simple math operation with that number — for example, your age in five years, or double your favorite number.
  • Uses at least two different strings and one number.

Turn It In

  • Save the file as first_program.py and submit it.

How It's Graded

This lab is worth up to 4 points. One score covers everything you turn in.

Score What it looks like
4 — Excellent first_program.py runs cleanly and prints all four required things — Hello, World!, your name and fun fact, your stored number, and a calculation — with the math done by Python from your variable, not typed in as an answer. At least two strings and one number, per the spec.
3 — Above Average Everything prints and the program runs, with a minor slip — a missing label on the calculation, or a number stored as a string.
2 — Average The program runs but skips a requirement — no variable, or no calculation, or the "math" is a number you typed yourself.
1 — Below Average The program doesn't run, or little beyond Hello, World! made it into the file.
0 — Failing Nothing submitted, or a file with no evidence you wrote a program.