Python
We introduced some basic statements and structures in the Python programming language. Let’s quickly review them!
Print Statement
The print(expression)
statement is used to print output on the terminal.
- It will evaluate
expression
to a value, then display it to the screen. - By default, it will add a newline to the end of the output.
- We can change that using the
end
parameter, such asprint(expression, end="")
to remove the newline.
Assignment Statement
The assignment statement, like a = expression
is used to create variables and store values in the variables.
- The variable must be on the left side, and the right side must be an expression that evaluates to a single value.
- If the variable does not exist, it is created. Otherwise, the current value of the variable is replaced by the new value.
- Variable names must begin with a letter or underscore, and may only contain letters, numbers, and underscores.
- Variable names beginning with an underscore have a special meaning, so we won’t use them right now.