2. Python Core Terms Flashcards
What is an “int”?
A data type representing whole numbers.
What is a “float”?
A data type representing decimal numbers.
What is a “str”?
A data type for sequences of characters (text).
What is a “bool”?
A data type with two values: True or False.
What is a “list”?
An ordered, mutable collection of items.
What is a “tuple”?
An ordered, immutable collection of items.
What is a “dict”?
A collection of key-value pairs.
What is a “set”?
An unordered collection of unique items.
What does “if” do?
Executes code only if a condition is true.
What does “for” do?
Loops over items in a sequence.
What does “while” do?
Repeats a block while a condition is true.
What does “break” do?
Exits the nearest loop.
What does “continue” do?
Skips to the next loop iteration.
What does “def” do?
Defines a function.
What is a parameter?
A variable in a function definition.
What is an argument?
A value passed to a function.
What is a lambda function?
An anonymous, single-expression function.
What does “*args” do?
Collects extra positional arguments.
What does “**kwargs” do?
Collects extra keyword arguments.
What is the difference between local and global variables?
Local variables exist within functions; global variables exist throughout the program.
What is “try” used for?
To attempt code that might raise an error.
What does “except” do?
Catches and handles errors.
What does “finally” do?
Always runs, even if there’s an error.
What does “raise” do?
Manually triggers an error.