What you will learn in Python Workout: 50 ten-minute exercises
50 ten-minute exercises
Chapter by chapter
Concepts explained in this book
- attributeAn attribute is a named value or behavior associated with a Python object or class and accessed through attribute syntax.
- inheritanceInheritance is an object-oriented technique in which a class derives functionality from an existing parent class and can add or modify that functionality.
- moduleA module is a distinct, bounded software unit that groups related code or functionality and provides an organizational or interaction boundary within a larger system.
- MapA dict is Python's mutable mapping type that associates hashable keys with values.
- generator expressionA generator expression is Python expression syntax that lazily produces successive values from an iterable instead of constructing the entire result collection immediately.
- integerAn integer is a Python numeric value representing a whole number without a fractional component.
- stringA string is a Python sequence type representing text as an ordered collection of Unicode characters.
- generatorA generator function is a Python function that produces a generator by yielding successive values while preserving its execution state between yields.
- iterableAn iterable is a Python object that can provide its elements sequentially to an iteration process.
- with statementA Python compound statement that manages one or more context-managed objects and ensures their cleanup when the block exits.
- methodA function associated with a class or object that defines an operation callable in the context of that class or object.
- ICPOA name-resolution order for locating attributes across an instance, its class, parent classes, and the object hierarchy.
- import statementAn import statement is a source-code declaration that makes names or definitions from another module, package, or namespace available in the current scope.
- immutable collectionA property of an object whose state cannot be changed after the object is created.
- iteratorAn iterator is an object that provides successive elements of an iterable, typically one element at a time.
- global variableA global variable is a variable defined outside a function and accessible through the module's global scope.
- constructor method__init__ is a Python instance method that initializes an object during instance creation.
- joinstr.join is a Python string method that concatenates an iterable of strings with the calling string placed between adjacent elements.
- classA class is a programming-language construct that defines a type’s structure or behavior and provides a basis for creating or representing objects.
- don't repeat yourself principleThe software-development principle of avoiding duplicated knowledge or logic by defining it once and reusing it.
- newlineA line feed is the control character that marks a line break and is represented by ASCII code 10.
- dictionary comprehensionA dict comprehension is Python expression syntax for constructing a dictionary by iterating over an iterable and producing key-value pairs, optionally with filtering or transformation.
- __next____next__ is a Python special method that returns an iterator's next value and signals exhaustion when no values remain.
- context managerA Python object implementing the context-management protocol for establishing and cleaning up a managed execution context.
- loopA loop is a control-flow construct that repeatedly executes a block of code.
- tupleA tuple is an ordered, finite Python sequence that is commonly immutable and can contain elements of different types.
- sys.pathsys.path is the Python list of directory path strings searched by the import system for modules and packages.
- __iter__A Python method that returns an iterator for an object, commonly returning the object itself when it is its own iterator.
- StopIterationStopIteration is the Python exception raised by an exhausted iterator to signal that no further values are available.
- sortedsorted is a Python built-in function that returns the elements of an iterable in sorted order as a new list.
- Bowl.add_scoopsBowl.add_scoops is a book-specific method that adds Scoop objects to a Bowl subject to its capacity limit.
- yieldyield is a Python statement that produces a value from a generator function while suspending its execution until the next value is requested.
- name-value pairA name-value pair is a data association in which an identifying name or key corresponds to a value.
- self parameterself is the conventional first parameter of a Python instance method that refers to the instance on which the method was invoked.
- splitstr.split is a Python string method that divides a string into a list of substrings using a specified separator or runs of whitespace by default.
- BowlBowl is a book-specific Python class representing a bowl that limits the number of scoops it can contain.
- infinite loopA loop whose condition remains true until an explicit control-flow operation exits it.
- empty stringAn empty string is a string containing zero characters.
- UnicodeA character-representation standard that assigns abstract code points to characters across writing systems and symbols.
- UTF-8UTF-8 is a variable-width Unicode character encoding that represents characters using one to four eight-bit code units.
- CSVCSV is a delimited text format in which records are typically represented as lines and fields are separated by a delimiter such as a comma.
- setA set is a Python collection of distinct, unordered elements.
- dict.getdict.get is a Python dictionary method that returns the value for a key or a specified default when the key is absent.
- slicingSlicing selects or partitions a portion of an indexed sequence or multidimensional array, often along specified indices or dimensions.
- input()input is a Python built-in function that displays a prompt and returns the user's response as a string.
- __str__A Python special method that returns an object's user-oriented string representation.
- standard libraryA standard library is a collection of reusable modules, types, functions, APIs, and other facilities distributed with a programming language implementation or platform.
- JSONA JSON file is a text file whose contents are serialized according to the JSON format.
- dynamic typingDynamic typing is a type system property in which an object's type is determined and checked at runtime rather than declared statically for each variable.
- type hintsA type annotation is optional Python syntax that associates a name or expression with an intended type without enforcing that type at runtime.
- default valueA function parameter that has a predefined value when the caller omits it.
- import aliasA module alias is an alternate name bound to an imported module by an import statement using as.
- Python Package IndexPyPI is the Python Package Index, a repository and distribution service for Python packages.
- openopen is a Python built-in function that creates and returns a file object for accessing a named file in a specified mode.
- scopeA local variable is a variable whose scope is limited to the function in which it is defined.
- closureA closure is a function that retains access to variables from its defining lexical environment after the enclosing function has returned.
- enclosing functionAn enclosing function is a lexically surrounding function whose local bindings can be accessed by a nested function.
- LEGBLEGB is Python's name-resolution order of local, enclosing-function, global, and built-in scopes.
- object-oriented programmingObject-oriented programming is a programming paradigm that organizes software around objects defined by classes containing state and behavior.
- file objectAn output file is a file created or written by a program to store generated data.
- __repr__A Python special method that returns an object's developer-oriented string representation, conventionally one that could represent the object in valid Python syntax.
- garbage collectionGarbage collection is the automatic reclamation of memory occupied by objects that are no longer accessible.
- mysummysum is a book-specific function intended to accept separate numeric arguments and return their sum.
- PythonPython 3 is the major version of the Python programming language in which input returns text entered by the user.
- f-stringA Python string literal prefixed with f that evaluates embedded expressions and supports format specifications.
- **kwargsPython function-parameter syntax that collects an arbitrary number of keyword arguments into a dictionary.
- random modulePython's standard-library module for generating pseudorandom values and selecting elements.
- file-like objectA file-like object is an object that exposes an interface resembling file operations such as reading and writing without necessarily being backed by a filesystem file.
- dispatch tableA dispatch table is a mapping from keys representing operations or cases to callable implementations selected at runtime.
- ScoopScoop is a book-specific Python object type representing an individual scoop that can be placed in a Bowl.
- glob moduleglob is a Python standard-library module for finding filesystem pathnames that match shell-style wildcard patterns.
- functional, stateless philosophyFunctional programming is a programming paradigm that emphasizes composing functions, minimizing mutable state, and transforming inputs into outputs.
- built-in namespaceThe built-ins namespace is Python's namespace containing names available as a final fallback during ordinary name resolution, including built-in functions and types.
- attribute lookupAttribute lookup is the runtime process Python uses to resolve a named attribute accessed through an object.
- dataclassdataclass is a Python standard-library decorator that generates class boilerplate such as an initializer, representations, and comparison methods from declared fields.
- default_factorydefault_factory is a dataclass field configuration that supplies a callable for creating a fresh default value for each instance.
- typing.Listtyping.List is a generic type-annotation construct describing lists whose elements have a specified type.
- typing moduleThe typing module is Python's standard-library module providing constructs for expressing and inspecting type annotations.
- randintrandint is a function that returns a pseudo-random integer within an inclusive lower and upper bound.
- superclassA parent class is a class whose attributes and behavior are inherited by a derived child class.
- operator moduleThe operator module is a Python standard-library module providing function equivalents for many built-in operators.
- jsonThe Python standard-library json module serializes Python objects to JSON and parses JSON into Python objects.
- json.loadjson.load() is a Python function that reads and parses JSON from a file-like object into the corresponding Python value.
- sorting algorithmSorting is the technique of arranging elements according to an ordering determined by their values or derived comparison keys.
- key parameterA parameter accepted by sorting functions that specifies a callable for extracting comparison keys from items.
- membership operatorPython's membership operator tests whether a value occurs within a container or iterable.
- os.listdiros.listdir is a Python standard-library function that returns the names of entries in a specified directory.
- floating-point arithmeticA floating-point value is a numeric value represented using a finite-precision significand and exponent, allowing fractional values and a wide magnitude range.
- global statementThe global statement declares that assignments and references to specified names in a function use the module-level global bindings.
- nonlocal statementThe nonlocal keyword declares that assignments in a nested function target a binding in an enclosing function rather than a new local binding.
- filteringFiltering is the technique of retaining elements that satisfy a condition while excluding others.
- zipzip is a Python built-in function that aggregates corresponding elements from multiple iterables into tuples until the shortest iterable is exhausted.
- data structureA data structure is an organized representation for storing and manipulating data in a program.
- expressionAn expression is a syntactic construct that Python evaluates to produce a value.
- linear time complexityAn asymptotic time complexity that grows proportionally with the number of elements processed.
- __name__ attributeA Python attribute containing the name associated with a module or class.
- items methoddict.items is the dictionary method that returns an iterator over the dictionary's key-value pairs.
- os.path.joinos.path.join is a Python standard-library function that joins path components using the separator conventions of the current operating system.
- break statementA Python control-flow statement that immediately terminates the innermost enclosing loop.
- keyA hashable identifier used by a dictionary to associate a stored value with a lookup name.
- boolean contextA Python evaluation context in which an object's truth value determines conditional or logical behavior.
- defaultdictA defaultdict is a dictionary subclass that creates and returns a default value for a missing key using a configured factory function.
- csvThe Python standard-library module that provides functionality for reading and writing comma-separated values and related delimited records.
- hashableA hashable type has values with stable hash values and can therefore be used for dictionary keys or set elements.
- CounterCounter is a dictionary subclass in Python's standard library that maps hashable objects to their integer counts.
- indexable typeAn indexable type is a type whose values support selecting an element or subsequence by a numeric index or slice.
- memory allocationMemory allocation is the process of reserving storage for data during program execution.
- sys.getsizeofsys.getsizeof is a Python function that returns the shallow memory size of an object in bytes.
- arrayAn array is an indexed, ordered collection of elements arranged in one or more dimensions, with elements accessed by position.
- __new__A Python special method responsible for creating and returning a new instance before initialization occurs.
- 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.
- Counter.most_commonCounter.most_common is a method that returns counted items and their frequencies in descending frequency order, optionally limited to a specified number of items.
- constant timeAn asymptotic time complexity that remains bounded independently of the number of elements processed.
- unhashableUnhashable describes a Python object whose value cannot be used as a dictionary key or set element because it lacks a suitable stable hash value.
- context manager protocolThe context manager protocol is the Python protocol defined by an object's __enter__ and __exit__ methods for managing a with statement's context.
- __enter__ methodThe __enter__ method is a special Python method invoked when execution enters a context manager and whose return value is bound by the with statement.
- __exit__ methodThe __exit__ method is a special Python method invoked when execution leaves a context manager and commonly performs cleanup or handles exceptions.
- inner functionAn inner function is a function defined within the body of another function.
- DecimalDecimal is a Python numeric class that provides decimal floating-point arithmetic with explicitly represented base-ten values.
- format methodstr.format is a Python string method that produces formatted text by substituting values into replacement fields.
- __all____all__ is a module-level sequence that specifies which names are exported by a wildcard import from that module.
- distribution packageA distribution package is a distributable wrapper containing a Python package together with metadata, dependencies, tests, licensing information, and installation instructions.
- __init__.py__init__.py is the conventional initialization file whose execution initializes a Python package when the package is imported.
- poetryPoetry is a Python dependency-management and packaging tool that creates, builds, and publishes Python projects.
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.
