What you will learn in Python Workout, Second Edition
200 ten-minute exercises
Chapter by chapter
Concepts explained in this book
- MapA dictionary is a mutable mapping in Python that associates hashable keys with values and preserves insertion order in modern implementations.
- inheritanceInheritance is the Python class relationship in which a derived class receives attributes and behavior from one or more base classes.
- integerAn integer is a whole-number numeric value without a fractional part, represented in Python by the int type.
- iterableAn iterable is a Python object that can provide its elements one at a time for iteration.
- functionA function is a callable program unit that encapsulates operations and can accept inputs and produce a result.
- generator expressionA generator expression is Python syntax that lazily produces values from an iteration expression without immediately constructing the resulting collection.
- stringA string is an immutable sequence of characters in Python, including text assembled with formatting.
- attributeAn attribute is a named value associated with a Python object and accessed through attribute lookup.
- import statementA module import is the Python operation that loads a module and makes its definitions available to importing code.
- generatorA generator function is a Python function containing yield that returns a generator object when called and resumes execution incrementally when iterated.
- with statementA with statement is Python syntax that executes a block under the management of a context manager and invokes the manager's entry and exit behavior.
- tupleA tuple is an immutable ordered collection in Python that can represent a fixed record of related fields.
- ICPOICPO is a mnemonic for Python attribute lookup order: instance, class, parents, and object.
- constructor methodThe __init__ method is Python's special instance-initialization method, called after an object is created to initialize its attributes.
- listA list is a mutable ordered collection in Python.
- classA class is a Python construct that defines the attributes and behavior of objects and can serve as a template for creating them.
- splitstr.split is the Python string method that divides a string into a list of substrings using a specified separator or, by default, runs of whitespace.
- joinjoin is the Python string method that concatenates iterable elements with the string on which it is called as a separator.
- scopeA scope is the region of Python code in which a name can be resolved according to the language's name-lookup rules.
- slice objectA slice is a Python specification of start, stop, and step bounds for selecting elements from a sequence or other sliceable object.
- data conversionType conversion is the transformation of a value from one data type to another, often by calling a target type as a constructor.
- input()The input function reads a line of text from standard input, optionally displaying a prompt, and returns it as a string.
- setA set is an unordered collection of distinct hashable values in Python.
- methodA method is a function associated with an object or class and invoked through that association.
- iteratorThe iterator protocol is the Python protocol through which an object supplies successive values for iteration.
- loopA for loop is a control-flow construct that repeatedly executes a block while iterating over items in an iterable.
- name-value pairA key-value pair is a two-part dictionary entry consisting of a key and its associated value.
- __next__The __next__ method is Python's special method that returns the next value from an iterator or raises StopIteration when no values remain.
- newlineA newline character is a control character representing the boundary between lines of text.
- superclassA parent class is a Python class from which a child class or subclass inherits attributes and behavior.
- sys.pathsys.path is the list of directory names that Python searches when locating importable modules and packages.
- sortedsorted is a Python built-in function that returns a new list containing the items from an iterable in sorted order.
- object-oriented programmingObject-oriented programming is a programming paradigm that organizes software around objects that combine state and behavior.
- named argumentA keyword argument is an argument passed by associating a value with a parameter name in a function call.
- sorting algorithmSorting is the technique of arranging elements according to an ordering determined by their values or derived comparison keys.
- dict.getdict.get is the dictionary method that returns the value associated with a key or a specified default when the key is absent.
- __iter__The __iter__ method is Python's special method for returning an iterator associated with an iterable object.
- dynamic typingDynamic typing is a type system in which values have runtime types and names can refer to values of different types without fixed variable declarations.
- closureA closure is a function that retains access to variables from an enclosing function scope after that enclosing function has returned.
- enclosing functionAn enclosing function is a function whose scope contains the definition or execution context of a nested function.
- LEGBThe LEGB rule is Python's variable-lookup order of local, enclosing, global, and built-in scopes.
- StopIterationStopIteration is the Python exception raised by an exhausted iterator to signal that no more values are available.
- glob moduleglob is a Python standard-library module for finding pathnames that match shell-style wildcard patterns.
- namespaceA namespace is a mapping that associates names with objects and separates those names from other naming contexts.
- splat operatorThe splat operator is Python's asterisk syntax for collecting multiple function arguments into a parameter or unpacking an iterable into separate function arguments.
- str.isdigitstr.isdigit is a Python string method that returns whether all characters in a string are decimal digits and the string is nonempty.
- variadic argumentsA variadic positional parameter collects an arbitrary number of positional arguments into a tuple.
- default valueA default parameter is a function parameter that receives a specified fallback value when no argument is supplied.
- dictionary comprehensionA dict comprehension is Python syntax for constructing a dictionary by iterating over an iterable and computing key-value pairs, optionally subject to filtering.
- file-like objectA file-like object is an object that provides an interface resembling a file, including operations such as reading, writing, or iteration.
- f-stringAn f-string is a Python string literal that evaluates embedded expressions and formats their values into the resulting string.
- infinite loopAn infinite loop is a loop whose condition remains true so that execution continues until an explicit exit changes the control flow.
- abstractionAbstraction is the representation of functionality at a level that hides lower-level implementation details.
- JSONJSON is a text-based data-interchange format that represents structured values such as objects, arrays, strings, numbers, booleans, and null.
- lambdalambda is Python syntax for creating an anonymous function from parameters and a single expression.
- exceptionAn exception is a Python runtime event representing an abnormal condition that can interrupt normal execution and be handled by exception-handling constructs.
- yieldyield is a Python statement or expression that produces a value from a generator function while suspending its execution for later resumption.
- file objectA file is a persistent named storage resource that Python can open, read, write, and close.
- os.path.joinos.path.join is a Python standard-library function that combines path components using the separator conventions of the current operating system.
- break statementbreak is a Python statement that exits the innermost enclosing loop.
- PythonPython is a general-purpose, high-level programming language known for readable syntax and broad application support.
- randintrandom.randint is a Python standard-library function that returns a pseudorandom integer between two specified inclusive bounds.
- random moduleThe random module is Python's standard-library module for generating pseudorandom values and making pseudorandom selections.
- operator moduleThe operator module is a Python standard-library module that provides function forms of built-in operators and related operations.
- attribute lookupAttribute lookup is Python's process for resolving an attribute name through an object's instance, class, inheritance hierarchy, and ultimate base object.
- dataclassA dataclass is a Python class whose commonly generated methods and field handling are supplied by the dataclass mechanism.
- type hintsA type annotation is syntax that associates a name or expression with an intended type without itself enforcing runtime type checking.
- dispatch tableA dispatch table is a mapping from selectable operation identifiers to callable implementations that can be looked up and invoked.
- jsonThe json module is Python's standard-library module for encoding Python objects as JSON and decoding JSON into Python objects.
- json.loadjson.load is a Python function that parses a JSON document from a text file-like object and returns the corresponding Python object.
- floating-point arithmeticfloat is Python's built-in constructor and conversion function for creating floating-point number objects.
- functional, stateless philosophyFunctional programming is a programming paradigm that emphasizes composing computations as functions and minimizing mutable state and side effects.
- openopen is Python's built-in function for opening a file and returning a file object for reading, writing, or appending.
- vowelA vowel sound is a speech sound articulated with an open vocal tract and functioning as the vocalic nucleus of a syllable.
- built-in namespacebuiltins is Python's namespace and module containing names automatically available to Python code.
- global statementThe global statement declares that assignments and name accesses in a function refer to a module-level global name.
- nonlocal statementThe nonlocal keyword declares that assignments in a nested function refer to a name in an enclosing function scope.
- delimiterA delimiter is a character or sequence of characters that separates adjacent fields or values in structured text.
- __repr____repr__ is Python's special method for producing an object's developer-oriented string representation, conventionally one that is unambiguous and potentially valid Python syntax.
- numeric baseA number base is the radix that determines the positional values of digits in a numeral system.
- callableA callable is a Python object that can be invoked using call syntax with parentheses.
- CSVA CSV file is a text file that represents tabular records with fields separated by delimiters, commonly commas.
- class hierarchyA class hierarchy is an organization of classes into parent-child relationships that represent shared and specialized behavior.
- membership operatorThe in operator is Python's membership operator for testing whether a value occurs in a container or iterable.
- pass statementThe pass statement is a Python statement that performs no operation while satisfying a syntactic requirement for a statement block.
- keyA dictionary key is a hashable value used to identify and retrieve a value in a Python dictionary.
- defaultdictdefaultdict is a collections class that supplies a default value for missing dictionary keys by calling a configured factory.
- enumerateThe enumerate function returns an iterator that yields pairs containing sequential indices and values from an iterable.
- filteringFiltering is a technique that selects elements satisfying a specified condition and excludes the others.
- function argumentA function argument is a value supplied to a function call for use by the corresponding parameter.
- indexingAn index is a numeric position identifying an element within an ordered sequence.
- packageA package is a Python namespace that organizes related modules and subpackages, typically represented by a directory.
- CounterCounter is a Python class in the collections module that maps hashable elements to their occurrence counts.
- boolean contextA Boolean context is a Python evaluation context in which an object's truth value determines control flow or a conditional result.
- atomic typeA type is a classification of Python objects that determines their values, behavior, and supported operations.
- expressionAn expression is Python syntax that evaluates to a value.
- hashableA hashable object is a Python object with a stable hash value that can be used as a dictionary key.
- comparisonA comparison operator is a Python operator that evaluates a relationship between two values and produces a Boolean result.
- assignmentAssignment is the Python operation that binds a value to a name or assigns it to a target.
- __new____new__ is a Python special method that creates and returns a new instance before initialization occurs.
- indexable typeAn indexable type is a type whose values support access by an integer index or a slice.
- arrayAn array is a data structure whose elements occupy a fixed-size, homogeneous sequence of storage positions.
- don't repeat yourself principleThe DRY principle is a software-development principle that avoids duplicating knowledge or logic by expressing it once and reusing it.
- csvThe csv module is Python's standard-library module for reading and writing comma-separated and other delimiter-separated tabular data.
- dict.setdefaultdict.setdefault is a dictionary method that returns a key's value and inserts the key with a default value when the key is absent.
- tuple unpackingUnpacking is a Python assignment operation that extracts elements from an iterable into separate targets.
- Counter.most_commonCounter.most_common is a Counter method that returns elements and their counts ordered from most common to least common.
- passwd fileA passwd file is a Unix system file containing account records such as usernames and login-shell information.
- constant timeConstant time is a computational complexity in which execution time does not grow with the size of the input.
- hash functionA hash function is a function that maps a hashable Python object to an integer hash value used by hash-based data structures.
- object systemAn object system is the collection of language mechanisms governing object creation, classes, inheritance, and object interactions.
- inner functionAn inner function is a function defined within the scope of another function or enclosing code block.
- side effectA side effect is an observable change or interaction produced by an operation in addition to its returned value.
- __all____all__ is a module-level sequence of names that defines the names exported by a wildcard import.
- directory structureA directory is a filesystem container that organizes files and other directories under a name.
- distribution packageA distribution package is an installable Python distribution containing package code, metadata, dependencies, licensing information, and installation instructions.
- __init__.py__init__.py is a conventional Python package file whose code is executed when the containing package is imported.
- wildcard importA wildcard import imports the names designated for export by a module rather than naming each imported name individually.
- Python Package IndexPyPI is the Python Package Index, a public repository and distribution service for Python packages.
- uvuv is a Python project and package management tool that can manage Python versions, environments, builds, and package publishing.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
