Essentials Flashcards
Variable
A named location in memory that stores a value. Variables don’t have an explicit type and can be reassigned.
Variable Assignment
The = operator sets a variable name to a value.
f-String
Formatted string literals that allow embedded expressions using f”” syntax.
Integer
Positive or negative whole number with no decimal point. Supports math operations.
Float
Number with a decimal point. Common for measurements and math with fractions.
Boolean
A True or False value often used for logic.
None
Represents no value assigned. Commonly seen as a default return value.
If
Starts a conditional block that executes in the condition is True.
Else
Adds a block that executes if the prior condition(s) was false.
Exception
Errors that disrupt normal program flow. Used to catch and handle errors.
Try/Except
Catch exceptions in the except block after first trying the code in the try block.
List
An ordered collection of values enclosed in square brackets []. Useful for storing sequences of items.
Index
The numeric position of an item in a list. Starts at 0 for the first item. Used to access items by position.
Iteration
Repeated execution of code on successive list items. Done in Python with a for-in loop.
Dictionary
Unordered collection of key-value pairs denoted with curly braces {}. Keys map to associated values.
Key
Unique identifier that is used to look up values in a dictionary. Look ups are 0(1).
Value
Data associated with a given key in a dictionary. Values can be any Python data type.
Tuple
Fixed-size, immutable ordered collection similar to a list. Denoted with (). Useful when data shouldn’t change.
Set
Unordered collection of unique objects. Helpful for removing duplicates and set operations.
Membership
Ability to check if a value is contained in a collection like lists, dictionaries, tuples, or sets.
Methods
Built-in functions that allow manipulating and interacting with data structures.
Iteration
The process of repeatedly executing code on each item in a collection one by one.
loop
A keyword used for an indefinite loop that runs forever until it is broken out of using a break statement or another control flow mechanism.