1/27
Vocabulary practice flashcards covering function arguments, keyword arguments, default parameters, arbitrary argument lists (*args, **kwargs), multiple returns, string slicing, advanced string formatting, string methods, and splitting/joining strings.
Pass-by-assignment
Python's argument-passing mechanism where arguments are passed by object reference, binding parameter names in the function's local namespace to the passed argument objects.
Immutable argument modification
A behavior where any modification to an immutable parameter (such as an integer or string) inside a function creates a new local object, leaving the original argument object unchanged outside the function.
Mutable argument modification
In-place modifications to mutable parameters (such as lists or dictionaries) within a function that persist outside the function's scope and affect other variables referencing that same object.
Keyword argument
An argument syntax that maps arguments to parameters explicitly by name rather than implicitly by position in the argument list.
Default parameter value
A predefined value assigned to a parameter in a function definition that is used if the corresponding argument is omitted from the function call.
Mutable default object problem
An issue where a mutable default parameter (such as an empty list) is created only once when the function is defined, causing modifications to persist across multiple function calls.
*args
A function definition parameter that collects optional positional arguments into an arbitrary argument list tuple.
**kwargs
A function definition parameter that collects extra keyword arguments into a dictionary whose keys match the argument names passed in the function call.
Multiple function outputs
The technique of packaging several values into a single container object, typically a tuple, to allow a function's single return statement to yield multiple values.
Unpacking
An operation that performs multiple assignments simultaneously to assign individual elements of a returned tuple or list to separate variables.
Index (string)
An integer matching a specific position in a sequence of characters, starting at 0 for the first character.
Slice notation
Syntax of the form my_str[start:end] that creates a new string containing characters from index start up to end - 1.
Stride
The optional third integer in slice notation (my_str[start:end:stride]) that determines how much to increment the index after reading each element, defaulting to 1.
Field width
A format specification component defined by an integer after a colon (such as {name:16}) that defines the minimum number of character spaces to output, padding with spaces by default.
Alignment character
A format specification character placed before the field width that determines whether a value is left-aligned (
Fill character
A character placed before the alignment symbol in a format specification (defaulting to an empty space) used to pad a replacement field when the inserted value is shorter than the field width.
Precision component
An optional format specification element starting with a period (such as :.2f) that indicates how many digits to display to the right of the decimal point for floating-point numbers.
replace()
A string method that returns a copy of the string with occurrences of an old substring replaced by a new substring, optionally limited to a specified count.
find()
A string method that searches for an item and returns the index of its first occurrence, or −1 if the item is not found.
rfind()
A string method that searches a string in reverse and returns the index of the last occurrence of the specified item.
count() (string method)
A string method that returns the number of times a specified substring occurs within the string.
in (string membership operator)
An operator that examines whether a character or substring exists anywhere within another string, evaluating to True or False.
Boolean string methods
A category of methods (including isalnum(), isdigit(), islower(), isupper(), and isspace()) that test string character content and return True or False.
strip()
A string method that returns a copy of a string with all leading and trailing whitespace removed.
Token
A substring that forms a constituent part of a larger string after being partitioned by a separator.
Separator
A character or sequence of characters that indicates the boundaries where a string is divided into tokens, or the character inserted between elements when joining.
split()
A string method that separates a string into a list of tokens based on a specified separator string, defaulting to any whitespace character.
join()
A string method that concatenates a list of strings into a single string, inserting the calling separator string between each list element.