Key words and examples
Every key word in this course in everyday language, and every real-world example with its picture. Use it to look things up or to revise.
🔑 Key words (34)
34 of 34 words
- append
- Adds one item to the end of a list.From: Lists and Loops
- Boolean
- A yes or no value. In Python: True or False.From: Variables: Labelled Boxes for Your Data
- Category
- The kind of expense, like food or travel.From: Final Project: Personal Expense Tracker
- Class
- A plan for making objects that hold data and actions.From: Classes, Modules and Testing Like a Pro
- Command-line app
- A program you use by typing in the terminal.From: Final Project: Personal Expense Tracker
- Condition
- A question with a yes or no answer, like "is it raining?"From: Making Decisions with if
- def
- The Python word that means "define a new function".From: Functions: Reusable Mini-Machines
- Dictionary
- A set of pairs. Each key points to one value.From: Dictionaries: Looking Things Up by Name
- elif
- Short for "else if". It checks another condition.From: Making Decisions with if
- else
- It catches everything that is left over.From: Making Decisions with if
- Exception
- Python's way of saying "something unexpected happened".From: Handling Errors and Reading Files
- for loop
- Code that repeats an action once for each item.From: Lists and Loops
- Function
- Steps packaged under a name so you can reuse them.From: Functions: Reusable Mini-Machines
- get
- A safe lookup. It returns a default when the key is missing.From: Dictionaries: Looking Things Up by Name
- Indentation
- Spaces at the start of a line. They show which lines belong to a choice.From: Making Decisions with if
- Index
- The position number of an item. The first one is 0.From: Lists and Loops
- Key
- The name you look up, like "name" or "age".From: Dictionaries: Looking Things Up by Name
- List
- Many values kept in order, written inside square brackets.From: Lists and Loops
- Logic
- The code that does the work, kept apart from the menu.From: Final Project: Personal Expense Tracker
- Module
- A .py file you can import into another file.From: Classes, Modules and Testing Like a Pro
- Object
- One real thing made from a class, with its own data.From: Classes, Modules and Testing Like a Pro
- Parameter
- An input of the function, like width or height.From: Functions: Reusable Mini-Machines
- A Python word that shows something on the screen.From: What Is Programming and Why Python?
- Program
- A list of instructions a computer follows, one by one.From: What Is Programming and Why Python?
- Programming language
- The set of words we use to write those instructions.From: What Is Programming and Why Python?
- Return value
- The result the function sends back.From: Functions: Reusable Mini-Machines
- String
- A piece of text, written inside quotes.From: What Is Programming and Why Python?
- Test
- Code that checks your code. assert means "this must be true".From: Classes, Modules and Testing Like a Pro
- try / except
- Try the risky lines. If they fail, run the except lines.From: Handling Errors and Reading Files
- Type
- The kind of value: text, whole number, decimal number, or yes/no.From: Variables: Labelled Boxes for Your Data
- Value
- The thing inside the box, like "Asha" or 21.From: Variables: Labelled Boxes for Your Data
- ValueError
- The error when a value is wrong, like "abc" for a number.From: Handling Errors and Reading Files
- Variable
- A named box that holds a value you can use and change.From: Variables: Labelled Boxes for Your Data
- with
- Opens a file and closes it for you, even if an error happens.From: Handling Errors and Reading Files
🏠 Real-world examples (9)
Lesson 1
What Is Programming and Why Python?
A program is a list of instructions. The computer follows them one by one, exactly as written. Python is a language for writing them that reads almost like English.
📌 A computer does exactly what you say, so say it clearly.
Lesson 2
Variables: Labelled Boxes for Your Data
A variable is a name that holds a value. You can read the value later, or put a new value in. The equals sign means "store this value under this name".
📌 The equals sign means "store this", not "is the same as".
Lesson 3
An if statement lets a program choose. It asks a yes or no question, called a condition. Python checks from top to bottom and runs only the first block that matches.
📌 Python runs only the first branch whose condition is true.
Lesson 4
A list holds many values in order. A for loop takes each item in turn and repeats the same action for it. Python counts list positions starting from 0.
📌 Python counts list positions starting from zero.
Lesson 5
Dictionaries: Looking Things Up by Name
A dictionary stores pairs. Each pair has a key and a value. You give the key and Python gives back the value, so you find data by name.
📌 Lists find by position. Dictionaries find by name.
Lesson 6
Functions: Reusable Mini-Machines
A function is a set of steps with a name. You give it inputs, it does one job and gives back a result. You can use it again and again.
📌 A function takes inputs, does one job, and returns an output.
Lesson 7
Handling Errors and Reading Files
Things go wrong, like a user typing letters where a number is needed. try and except let the program react and carry on. Files keep data after the program closes.
📌 Catch the specific errors you expect, and let the rest show up.
Lesson 8
Classes, Modules and Testing Like a Pro
Three things keep a growing program tidy. A class is a plan for making objects. A module is a file of code you can import. A test is code that checks your code.
📌 A class is the plan, a module is the file, a test is the check.
Lesson 9
Final Project: Personal Expense Tracker
In this project you build a small expense tracker that runs in the terminal. The user adds expenses, lists them and sees totals. The program saves them to a file.
📌 Start small, add one requirement at a time, and test as you go.