Week 2 Flashcards
What are assignment statements
Assignment statements use the assignment operator ‘=’ to define variables
What do you need to define a variable?
- The name of the variable
- The initial value of the variable
What are some invalid variable names?
- Starts with a number
- Contains a space
- Is a reserved word
- Contains symbols (other than _ )
What are python arithmetic operations?
+, -, /, *
also powers= **
Floor division (ignores the fractional part) = //
Modulo division (remeainder)= %
List python data types
- Integer
- Float
- String
- Complex numbers
- Boolean
Define integer
Whole numbers
Define float
Decimal numbers
Define string
sequence of characters
Define complex numbers
A number with a real and imaginary part
Define boolean
Two possible values: True or False
Is python dynamically typed or statically typed?
Dynamically typed
What are constants
Constants are variables whose value does not change after it has been assigned an initial value. Python does not enforce constants but it is good programming practice to use all CAPS for variables that should be treated as constants.
What is the None data type?
The None data type is Pythons version of null or no value. It is not zero, false or an empty string. It is a special data type: NoneType.