Basic Terms

Before continue writing more lines of code, we need to learn some basic terms. In this handout, I’m going to talk about what are them, not how to using them. We will learn to use them in detail one by one when the course goes on.


A value …. is a value. But in programming, it’s not just a number. A value can be a word, a number, a color….


Have you ever see something like x=10 in your math class? The “x” here represents 10.

In Python, the concept of a variable is like “x” in your math class, but have little difference.

Namex,y or other lettersAny name you want (but needs to follow certain naming rules), for example rest, inputValue, player_head_left.
ValuenumbersEverything. Numbers, sentences, colors, lists and a lot more.
Mutability (can it change)cannot changevariable is mutable (at least most of the time), you can change it to anything at any time you want.


Math class again. The concept of operators are like plus sign, minus sign in math.

Some operators in Math are very similar to math (for example +, -): they all result as a number.

Other operators in Python are not doing math, they are checking is True or False. For example they can check if the value of one variable equals another variable’s value.


You may heard about function in math class. (Hahaha math class yet again) Let’s do a comparison.

input (parameters)only numbersanything, same as what you can put in a variable
output (return value)one numberanything, a function can don’t return anything, return one value or return multiple value at once
what does function domathematic calculationanything, maybe add two number, maybe draw an image on the screen, maybe take a picture of you

As you can see, functions in Python can do much more than it in math.

Functions is a type of value too. In other words, a function is stored in a variable and can be assigned to other variables like other types of the value. //move this line to function

Control Flow

Finally, we got something that’s not exist in your math class.

What control flow does is it controls how your code flows. (Okay I know it sounds obvious) You can use Control flow to let a certain part of your code only execute if the condition you gave it is satisfied. Or you can use control flow to run a part of your code multiple times.


Reading “languages of computers” is sometimes boring and hard to understand. You can write some comments in your code to help yourself and others to understand your code better. When your program is executed, your comment will ignored by computer.

Next: Values