Python Basics

20 min read

Python is the language that most AI work is written in. In this lesson you write your first lines of real Python, right here on this page. You will store values, work with numbers and text, make decisions, and read error messages. You do not need any programming experience.

New words

program
A list of instructions that tells a computer what to do, step by step.
variable
A named box in the computer that holds a value, like a labelled tiffin box.
string
Text inside quotes, such as "hello", which is a chain of letters.
type
The kind of a value, such as a whole number, a decimal number or text.
function
A named action that does one job, such as print().
indentation
Empty space at the start of a line that shows which lines belong together.
error message
Python's note that says which line failed and what kind of problem it is.

What you will learn

  1. Why do AI engineers use Python?
  2. What are print() and variables?
  3. Types: what kind of value is in the box?
  4. Working with text
  5. Comparing and deciding
  6. Try it: the variable boxes
  7. Common mistakes and how to read an error
  8. Explain it to a friend
  9. Key takeaways

10 quiz questions at the end.

Start this lesson

The full lesson, with interactive demos and the quiz, opens after you sign in with Google. It is free.

All lessons · Back to the roadmap