1/21
Flashcards covering Python data types, numeric types, boolean evaluation, various operator groups, collection types (Lists, Tuples, Sets, Dictionaries), and conditional control flow.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What function is used to get the data type of an object in Python?
The type() function (e.g., print(type(x))).
What are the three built-in numeric types in Python?
int, float, and complex.
How is an integer (int) defined in Python?
A whole number, positive or negative, without decimals, of unlimited length.
What is a float, or "floating point number"?
A number, positive or negative, containing one or more decimals.
How are complex numbers written in Python?
With a j as the imaginary part (e.g., 3+5j).
What function is used to evaluate any value and return True or False?
The bool() function.
What does the arithmetic operator // represent?
Floor division.
What does the arithmetic operator ∗∗ represent?
Exponentiation.
What are the two identity operators in Python?
is and isnot.
What is the purpose of membership operators like in and notin?
They are used to test if a sequence is presented in an object.
What does the bitwise operator ^ represent?
XOR (Sets each bit to 1 if only one of two bits is 1).
According to operator precedence, which operator is at the very top of the hierarchy?
Parentheses ().
In Python, what brackets are used to create a List?
Square brackets [].
What are the three defining characteristics of List items?
They are ordered, changeable, and allow duplicate values.
Which function is used to determine the number of items in a list?
The len() function.
Define the characteristic of a Tuple.
A collection which is ordered and unchangeable, and allows duplicate members.
Define the characteristic of a Set.
A collection which is unordered, unchangeable*, and unindexed, with no duplicate members.
Define the characteristic of a Dictionary.
A collection which is ordered** and changeable, with no duplicate members.
What does Python rely on to define scope in the code?
Indentation (whitespace at the beginning of a line).
What keyword is used in Python to catch anything not caught by preceding conditions in an if statement?
The else keyword.
What is a "nested if" statement?
An if statement inside another if statement.
What statement is used to avoid an error if an if statement has no content?
The pass statement.