Open workspace
Python · Module 1

Getting Started6 lessons, and everything around them.

Watch each lesson, answer its quiz, then do its practice. After the last lesson: the module quiz, the project, and the interview questions.

6of 6 lessons ready
45quiz questions
17key terms
4self-checking notebooks

The lessonsin the order to take them.

6 lessons ready to study
  1. 1.1Why Python?Say what Python is and why it is used for AI and machine learning, and know where Python code is written and run. Open
  2. 1.2Run Your First Python CodeRun Python in a notebook and know what happens when a cell executes. Open
  3. 1.3Variables, Keywords and IdentifiersBind names to objects, and name variables by Python's rules. Open
  4. 1.4Data TypesKnow the basic types and how they convert. Open
  5. 1.5Input, Output and FormattingRead input and print results readably. Open
  6. 1.6OperatorsCompute and compare with Python's operators, and know their precedence. Open

Glossaryevery term the module introduces.

Each with the lesson that introduces it.

programming language
precise rules for writing instructions a computer can carry out 1.1
interpreted
the interpreter executes code one statement at a time 1.1
library
published code your program can import and use 1.1
notebook · cell
a document made of cells; a code cell holds Python, a text cell holds notes 1.1
function · argument
a named piece of code that does one job · a value passed to it 1.2
string
text, written in quotes 1.2
statement
one instruction 1.2
comment
text after #, skipped when the code runs 1.2
kernel · execution count
runs the cells and keeps their names · the order cells ran 1.2
variable · assignment
a name given to a value · the instruction that gives it 1.3
object · namespace · bind
a value in memory with its type · the table of names · add a name with a reference to an object 1.3
identifier · keyword
the name of a variable · a word Python reserves (35 in 3.12) 1.3
int · float · complex · bool · str · None
whole number · decimal number · complex number · True/False · text · no value 1.4
type annotation
the intended type, age: int = 7; not checked by Python 1.4
"f" string · format specifier
f"{price:.2f}" · after the colon, how a value is shown 1.5
operator · operand · expression
+ · the values it works on · code that evaluates to a value 1.6
precedence
the order operators run in: **, unary -, * / // %, + -, comparisons, not, and, or 1.6

Module quiz15 questions across it all.

Take it after the last lesson. Write each answer down before you check it.

  1. 01

    Python code is executed one statement at a time by which program?

  2. 02

    What does a notebook cell show when its last line is 2.25 + 1.25 + 3.50, with no print?

  3. 03

    After a restart, a cell containing total = bread + milk + eggs is run before the cell that creates bread. What happens?

  4. 04

    After a = 24.75 and b = a, what is a is b?

  5. 05

    Then a = 26.25. What is b?

  6. 06

    Is 2nd_item a valid identifier? Is item_2?

  7. 07

    What is bool("False")?

  8. 08

    What is int(-7.9)?

  9. 09

    What does int("3.0") give?

  10. 10

    A user types 3 at people = input("People: "). What is people * 2?

  11. 11

    What does print("Total: {x}") print, when x = 5?

  12. 12

    What is f"{1234.5:,.2f}"?

  13. 13

    What is 10 / 5? And -7 // 2?

  14. 14

    What is 70 / 1.75 ** 2, to one decimal place, and why is it not 1600.0?

  15. 15

    What is round(2.5)? And 0.1 + 0.2 == 0.3?

Project: Bill Splitterbuild it without a template.

Stated as a problem, with no step-by-step instructions. Working out the steps is the point.

The task

Write a program, in one Colab notebook, that does the following. 04_module_project.ipynb checks the core of it (the total, the shares, and how many people pay a cent more). Your program must:

  1. asks for the bill amount, the tip as a percentage, and the number of people;
  2. prints the tip, the total with tip, and each person's share, each to the cent and with a $ sign;
  3. prints the shares so that they add up to exactly the total, even when the total does not divide evenly;
  4. has a comment on every line that computes something.

Notebooksthat check your answers.

Open them in Google Colab. Each answer is checked as you go: correct, wrong with the expected value, or not answered yet.

Referencefor revising and for interviews.

The cheat sheet is one page of the module’s terms, rules and gotchas. The interview questions come with model answers.