Caveat Academic Services
Every course and price · Practice course
Practice course · Grades 7 to 12 · A first course in programming

Intro to Coding with Python

A first course in programming with Python in six units: printing and reading error messages, variables and input, decisions, loops, lists and functions, and three small projects that tie it all together. Most students finish a unit every one to two weeks, coding in a free online Python editor with no sign-up.

Read lesson 1 belowSelf-pacedIncluded with Caveat Plus
Cover of Intro to Coding with Python

6 modules · 18 lessons · about 16 hours · practice after every lesson and an exam for every module

Module 1 · Lesson 1 of 3

Your first program: print

A program is a list of instructions that a computer follows exactly, in order, from top to bottom. Python is a programming language whose instructions read almost like English. People use it to build websites, analyze science data and make games, and it is one of the most popular first languages to learn.

Where you will write code

You only need a web browser. Search for a free online Python editor; many run Python right in the page with no sign-up and no download. Look for three things: a box where you type code, a Run button, and an output area, often called the console, where results appear. If Python is already installed on your computer, that works too.

Program
a set of instructions for a computer
Code
the instructions written in a programming language
Run
tell the computer to carry out the code
Output
what the program shows when it runs
Function
a named command that does a job; print is a function
String
a piece of text inside quotation marks

The print function

print() shows something in the output area. Whatever goes inside the parentheses is printed. Text must go inside quotation marks so Python knows it is text and not a command. Numbers need no quotes.

Worked example: three lines

  1. print('Hello, world.')
  2. print('My name is Mira.')
  3. print(7)
  4. Each print starts a new line.
  5. Output: Hello, world. on line 1, My name is Mira. on line 2, and 7 on line 3.

You can give print several items separated by commas. Python prints them on one line with a single space between them. An empty print() prints a blank line, which is handy for spacing out your output.

Worked example: commas and a blank line

  1. print('Score:', 12)
  2. print()
  3. print('Game', 'over')
  4. Line 1 of the output shows Score: 12 with one space added by the comma.
  5. Line 2 is blank.
  6. Line 3 shows Game over.

Try it now: type each example into your editor, press Run and compare your output with the one shown. Then change the words and run it again. Typing code yourself instead of pasting it builds the habit of noticing small details, and small details matter a lot in programming.

The rest of the course comes after checkout

This is the real start of lesson 1.

What you will be able to do

  • Write print statements with strings, joining, repetition and comments, and diagnose errors from their messages.
  • Predict the results of variables, arithmetic operators, type conversion and f-strings.
  • Write and trace decisions with comparisons, if, elif and else, and and, or and not.
  • Trace for and while loops, accumulators and break, and choose the right loop for a task.
  • Process lists with loops and write functions that take parameters and return values.
  • Design, test and debug small programs from a written plan.

What is in the course

  1. Module 1: First programsYour first program: print · Strings and comments · Errors and reading error messages · about 2.3 hours
  2. Module 2: Variables, numbers and inputVariables and types · Arithmetic · Input, int(), str() and f-strings · about 2.5 hours
  3. Module 3: DecisionsBooleans and comparisons · if, elif and else · and, or and not · about 2.8 hours
  4. Module 4: Loopsfor loops and range · while loops · Accumulators and break · about 2.9 hours
  5. Module 5: Lists and functionsLists and indexing · Looping over lists · Defining functions · about 2.9 hours
  6. Module 6: Small projectsProject: a number guessing game · Project: a grade calculator · Project: a text adventure, and debugging · about 2.1 hours

For families

No prior coding experience is needed, and all your student needs is a web browser and a free online Python editor, with nothing to buy or install. Plan on about 30 to 45 minutes per lesson, and ask your student to show you a program they wrote each week; this is a practice course and does not award credit.

See every course

Secure checkout by StripeYour card details go to Stripe, not to us.
Ready right after checkoutNothing to wait for. It stays in your account.
For your familyIncluded with Caveat Plus. Questions: team@caveatacademic.com.

For use by the purchasing family; please do not resell or post it. Questions or a problem with an order: team@caveatacademic.com. Caveat Academic Services is independent and not affiliated with any school district or curriculum publisher.

Written with AI, then checked before it is published. How we checkFound a mistake? Report it and we fix it, or refund you.Cancel anytime.