u01-slides-python Flashcards
What is the standard filename suffix for Python files?
.py
What version of Python is recommended in the course?
Version ≥ 3.11
In what order is Python code executed?
Line by line from first line to last line
How are expressions evaluated in Python?
From left to right (e.g. a + b + c is equivalent to (a + b) + c)
How are assignments evaluated in Python?
From right to left (e.g. x = a + b is equivalent to x = (a + (b)))
What character is used to start a comment in Python?
The hashtag character (#)
What is the purpose of comments in Python code?
To document code - they are not executed and have no effect on program behavior
What are the main data types covered in the course?
bool (Boolean), int (Integer), float (Float), str (String)
What values can a Boolean data type store?
Only two values: False (0) or True (1)
What is special about integers in Python?
They are not limited by fixed size (e.g. 32 bits) but are variable-length objects of arbitrary size
What is the range for double-precision floats in Python?
Between approximately ±2.2 × 10^-308 and ±1.8 × 10^308
What is dynamic typing in Python?
The data type is determined during run time and is associated with the value itself not the variable
What are variables in Python?
References or names that are bound to objects - they don’t store information themselves
What are the rules for variable names in Python?
Must start with non-digits/non-operators, are case sensitive, conventionally lowercase with underscores
How do you get user input from the console in Python?
Using the input() function