Chapter 2 - Definitions Flashcards
Assignment statement
A statement that assigns a VALUE to a name (VARIABLE). To the left of the assignment operator, =, is a NAME. To the right of the assignment token is an expression which is evaluated by the Python interpreter and then assigned to the NAME. The difference between the left and right hand sides of the assignment statement is often confusing to new programmers.
In the following assignment:
n = n + 1
n plays a very different role on each side of the =. On the right it is a VALUE and makes up part of the EXPRESSION which will be evaluated by the Python interpreter before assigning it to the name on the left.
Define assignment token
= is Python’s assignment token, which should not be confused with the mathematical comparison operator using the same symbol.
Define class
see data type below
Define comment
Info in a program that is meant for other programmers (or anyone reading the source code) and has no effect on the execution of the program
Define data type
A set of values. The type of a value determines how it can be used in expressions. So far, the types you have seen are integers (int), floating-point numbers (float), and strings (str).
Define decrement
Decrease by 1
Define evaluate
To simplify an expression by performing the operations in order to yield a single value.
Define expression
A combination of operators and operands (variables and values) that represents a single result value. Expressions are evaluated to give that result.
Define float
A Python data type which stores floating-point numbers. Floating-point numbers are stored internally in two parts: a base and an exponent. When printed in the standard format, they look like decimal numbers. Beware of rounding errors when you use floats, and remember that they are only approximate values.
Define increment
Both as a noun and as a verb, increment means to increase by 1.
Define initialization (of a variable)
To initialize a variable is to give it an initial value. Since in Python variables don’t exist until they are assigned values, they are initialized when they are created. In other programming languages this is not the case, and variables can be created without being initialized, in which case they have either default or garbage values.
Define int
A Python data type that holds positive and negative whole numbers.
Define integer division
An operation that divides one integer by another and yields an integer. Integer division yields only the whole number of times that the numerator is divisible by the denominator and discards any remainder.
Define keyword
A reserved word that is used by the compiler to parse program; you cannot use keywords like IF, DEF, and WHILE as variable names.
Define modulus operator
Also called remainder operator or integer remainder operator. Gives the remainder after performing integer division.