What you will learn in Learn AI-Assisted Python Programming, Second Edition
With GitHub Copilot and ChatGPT
Chapter by chapter
Concepts explained in this book
- testA test case is a defined software-testing scenario consisting of inputs and the expected behavior or result.
- inputA parameter is a named input specified by a function definition that receives information when the function is called.
- decompositionTask decomposition is the practice of dividing a large problem or program into smaller, more manageable tasks or subproblems.
- top-down designTop-down design is a software-design technique that starts with an overall task and progressively refines it into smaller subtasks and functions.
- debuggingDebugging is the process of locating, diagnosing, and correcting defects in a program.
- play (dice game)play is a book-specific Python function that runs the complete two-player dice game without parameters or a return value.
- loopA loop is a programming construct that repeatedly executes a block of code while iterating over values or while a condition holds.
- signatureAn authorship signature is a computed collection of textual characteristics representing an author's writing style.
- authorship identificationAuthorship identification is the task of determining which known author most likely produced an unknown text by comparing characteristics of the texts.
- 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.
- edge caseAn edge case is a software-testing scenario involving an uncommon, boundary, or otherwise exceptional input that may expose defects.
- average number of words per sentenceAverage number of words per sentence is the mean count of words contained in the sentences of a text.
- stringA string is a sequence of characters represented as a text value in a programming language.
- sentence complexitySentence complexity is a text measure calculated from the average number of punctuation-delimited phrases per sentence.
- osos is a Python standard-library module providing an interface to operating-system services, including filesystem operations.
- guess_resultguess_result is a book-specific Python function that compares a player's guess with a secret code and reports the matching and misplaced digits.
- get_all_signaturesget_all_signatures is a book-specific Python function that obtains authorship signatures for a collection of books with known authors.
- 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.
- leaf functionA leaf function is a function that performs its work without calling other helper functions, apart from built-in functions it may invoke.
- callA function call is an invocation that transfers execution to a function and resumes at the code following the invocation when the function returns.
- make_signaturemake_signature is a book-specific Python function that computes five numerical authorship features from text and returns them as a list.
- exactly_once_to_totalA book-specific Python function that calculates the proportion of words occurring exactly once in a text relative to the total number of words.
- exactly-once word ratioA text statistic equal to the count of words occurring exactly once divided by the total count of words.
- random_stringrandom_string is a book-specific Python function that generates a secret digit string of a requested length without repeated digits.
- get_guessget_guess is a book-specific Python function that obtains a player's guess containing a required number of distinct digits.
- lowest_scorelowest_score is a book-specific Python function that compares an unknown signature with each known signature and returns the known signature having the smallest score.
- split_stringsplit_string is a book-specific Python function that divides text into separated parts while handling surrounding spaces and empty results.
- average_word_lengthA book-specific Python function that computes the average number of letters per word while excluding surrounding punctuation and words containing no letters.
- clean_wordclean_word is a book-specific Python function that removes punctuation surrounding a word and converts the word to lowercase while preserving punctuation within the word.
- get_scoreget_score is a book-specific Python function that computes an authorship-comparison score from weighted differences between signatures.
- signature comparison scoreAn authorship comparison score is a weighted numerical measure of the differences between two authorship signatures, with a lower value indicating greater similarity.
- GitHub CopilotGitHub Copilot Chat is a conversational interface for GitHub Copilot that supports software-development tasks with natural-language explanations, code, and actions.
- language modelA large language model is a machine-learning model that represents statistical relationships among language elements and predicts sequences of text from context.
- different-to-total ratioThe different-to-total ratio is the number of distinct words in a text divided by the total number of words.
- get_sentencesget_sentences is a book-specific Python function that produces sentences from text by delegating string-splitting work to another function.
- comparisonA comparison is a language operation that tests a relationship between values or expressions, such as equality or ordering, and produces a result.
- get_phrasesget_phrases is a book-specific Python function that returns a list of phrases parsed from a sentence.
- breakpointA breakpoint is a designated program location at which a debugger pauses execution before the associated code runs.
- Step OverStep Over is a debugger command that advances execution to the next line in the current function without entering called functions.
- average_sentence_lengthaverage_sentence_length is a book-specific Python function that calculates the average number of words per sentence in text.
- PyPDF2PyPDF2 is a Python library for reading, creating, manipulating, and writing PDF documents.
- BogartBogart is a dice-based computer game in which players accumulate chips and may win them based on their rolls.
- correct digitA correct digit is a guessed digit that matches the digit in the corresponding position of the secret code.
- misplaced digitA misplaced digit is a guessed digit that occurs in the secret code but is located at a different position.
- game_overgame_over is a book-specific Python function that determines whether the Bogart game has ended from player chip counts and recent dice rolls.
- roll_diceroll_dice is a book-specific Python function that rolls a specified number of dice and returns their results as a list.
- switch_playerswitch_player is a book-specific Python function that returns the other player's number when the game continues or preserves the current player's number when the game ends.
- take_full_turntake_full_turn is a book-specific Python function that carries out a current player's dice-rolling turn and returns the updated pot and recent rolls.
- turn_overturn_over is a book-specific Python function that determines whether a player's turn ends based on the rolls made or the number of dice rolled.
- wins_chipswins_chips is a book-specific Python function that determines whether a player receives the pot based on whether the rolls contain a 1.
- PdfReaderPdfReader is a PyPDF2 API class for reading and accessing the contents of an existing PDF document, replacing PdfFileReader in later versions.
- PyMuPDFPyMuPDF is a library for accessing and processing PDF documents and their text, graphics, and images.
- directory structureA directory is a filesystem container that organizes files and other directories by name.
- secret codeA secret code is a hidden sequence of digits that a player must identify in the Bulls and Cows-style game.
- randomnessRandomness is the property of an outcome or event being determined by chance rather than being fully predictable from the available information.
- dieA die is a numbered game object rolled to produce a random value, typically from one through six.
- playerA game player is an individual participating in an interactive game by taking turns and making game actions.
- potA pot is the shared pool of chips accumulated during a game and potentially awarded to a player.
- bugA software bug is a defect in a program that can cause it to produce incorrect behavior or fail under particular conditions.
- docstringA string literal placed in a program construct to document that construct and make its documentation available to programming tools.
- doctestdoctest is a Python standard-library module and testing mechanism that executes interactive examples embedded in documentation and checks their output.
- clipboardA clipboard is an operating-system-managed temporary storage area for data transferred between applications through copy-and-paste operations.
- pyperclippyperclip is a Python library that provides cross-platform functions for copying text to and pasting text from the system clipboard.
- insert_pdfinsert_pdf is a PyMuPDF method that inserts the pages of one PDF document into another document.
- pippip is Python's package installer for downloading and installing software packages and their dependencies.
- rangeThe Python range function produces an integer sequence whose upper bound is exclusive.
- Call Stack sectionThe Call Stack section is a debugger panel that shows the active chain of function calls leading to the current execution point.
- Debug ToolbarThe Debug Toolbar is the Visual Studio Code debugger control bar for advancing, restarting, and stopping program execution.
- Step IntoStep Into is a debugger command that advances execution and enters a function called by the current code when possible.
- Visual Studio Code debuggerThe Visual Studio Code debugger is the integrated debugging facility that controls program execution and exposes runtime state in the editor.
- Watch sectionThe Watch section is a debugger panel that evaluates and displays expressions selected for monitoring during execution.
- CSVCSV is a text-based tabular data format that represents records as lines and fields separated by delimiters, commonly commas.
- data handlingThe collection, transformation, filtering, and analysis of data to produce usable information.
- passing yardsThe total distance in yards gained by an American football quarterback's completed forward passes.
- quarterbackAn American football player responsible primarily for directing the offense and throwing passes.
- NFL offensive stats datasetA book-specific dataset and CSV file containing National Football League offensive statistics from 2019 through 2022.
- natural languageA natural language is a human language that arises through ordinary human communication rather than being designed primarily for programming computers.
- indentationIndentation is leading whitespace or spacing that positions content relative to its surrounding area and can represent hierarchy or structural nesting.
- determinismDeterminism is the property that fixed inputs and conditions produce a fixed outcome.
- filecmpfilecmp is a Python standard-library module for comparing files and directories.
- shutilshutil is a Python standard-library module that provides high-level operations for copying, moving, archiving, and managing files and directories.
- password authenticationA password is a secret character sequence used to authenticate a user or protect access to an account or system.
- Python interactive promptThe Python interactive prompt is the interpreter interface marker at which users enter Python code for immediate evaluation.
- return valueA return value is the result that a function sends back to the code that called it.
- debuggerA debugger is a software tool that allows a programmer to inspect and control a program during execution to diagnose defects.
- PDF mergingPDF merging is the process of combining multiple PDF documents or pages into a single ordered PDF document.
- trainingModel training is the process of fitting an artificial-intelligence model to patterns in data so it can produce outputs for new inputs.
- PythonPython is a high-level, general-purpose programming language designed for readable syntax and broad application development.
- elif clauseAn elif statement is a Python conditional branch that tests an additional condition when preceding if or elif conditions were false.
- MapA map is an associative data structure that stores key-value pairs and supports retrieving values by key.
- listAn empty list is a list containing no elements.
- syntaxSyntax is the set of symbols, words, and rules governing the valid structure and notation of programs in a programming language.
- prompt engineeringThe practice of designing and refining instructions for an AI system to improve the relevance and correctness of its outputs.
- string methodA string method is an operation provided by Python's string type for inspecting or producing text values.
- printA print statement is a language construct that writes a value or text representation to an output stream.
- synthetic dataSynthetic data is data generated artificially rather than collected directly from the target process, often to approximate its properties or meet specified requirements.
- return statementA return statement ends a function execution and optionally provides a value as the function's output.
- training datasetTraining data is the collection of examples used to fit a machine-learning model and establish the statistical patterns it predicts.
- with statementA with statement manages a context-bound resource by entering its context before a block and reliably exiting it afterward.
- file objectA data file is a file containing information that a program reads, processes, or produces.
- bindingName binding is the association of an identifier with the program entity or value it denotes.
- zipfileThe zipfile module is a Python standard-library module for creating, reading, writing, and extracting ZIP archives.
- debugging hypothesisA debugging hypothesis is a proposed explanation for a program defect that guides investigation and testing.
- probability theoryProbability is a numerical measure of the likelihood that an event will occur.
- nonleaf functionA nonleaf function is a function that combines or coordinates multiple operations, often by invoking other functions.
- nested loopA nested loop is a loop whose body contains another loop, causing the inner loop to complete its iterations for each iteration of the outer loop.
- arrayA two-dimensional list is a list whose elements represent rows or nested collections, forming a grid-like structure.
- logical errorA logical error is a program defect in which syntactically valid code computes an incorrect result or performs behavior that does not match its intended logic.
- refactoringCode refactoring is the restructuring of existing code to improve its readability or maintainability without changing its intended behavior.
- slicingSlicing selects or partitions a portion of an indexed sequence or multidimensional array, often along specified indices or dimensions.
- assembly languageAssembly language is a low-level programming language that represents machine instructions using symbolic mnemonics and operands closely tied to a computer's processor.
- flipped interaction patternA flipped interaction pattern is a prompt pattern in which the language model asks the user questions instead of only answering the user's questions.
- machine learningMachine learning is a field of artificial intelligence in which systems infer patterns from data to make predictions or decisions.
- supervised learningSupervised learning is a machine-learning approach that learns from examples paired with categories or target outputs.
- code analysisCode reading is the deliberate examination of source code to understand its behavior and locate defects.
- methodA method is a function associated with an object or type and invoked through that association.
- input()The Python input function reads a line of text from an input stream, typically the user's keyboard, and returns it as a string.
- cognitive loadCognitive load is the amount of information and number of constraints a person can mentally process effectively at one time.
- csvThe csv module is Python's standard-library module for reading and writing comma-separated and other delimiter-separated tabular data.
- readlineThe readline method reads and returns the next line from a file-like object as text.
- open-box testingOpen-box testing is a software-testing technique that examines a program's implementation to identify likely failures and design structure-specific tests.
- letter deletionLetter deletion is the operation of generating strings by removing one letter from an existing string.
- letter insertionLetter insertion is the operation of generating strings by adding one letter at a selected position in an existing string.
- letter substitutionLetter substitution is the operation of generating strings by replacing one letter in an existing string with another letter.
- pdftkpdftk is a command-line toolkit for manipulating PDF documents, including concatenating and splitting files.
- Copilot explain featureThe Copilot /explain command requests an explanation of selected code in Copilot Chat.
- coordinating functionA coordinating function is a function that primarily orchestrates calls to other functions rather than performing substantial work itself.
- closeThe close method releases a file object's resources and ends access to the associated file.
- openThe Python open function creates a file object for accessing a named file with a specified mode.
- splitThe string split method divides text around a separator and returns the resulting parts as a list.
- premature optimizationPremature optimization is the practice of optimizing a program before establishing that its current implementation is inadequate or identifying the relevant performance bottleneck.
- known signatureA known signature is an authorship-style representation computed from text written by an identified author.
- unknown signatureAn unknown signature is an authorship-style representation computed from text whose author has not been identified.
- spelling correctionA spelling suggestion is a proposed correctly spelled word corresponding to a misspelled input.
- biasBias in AI results is systematic skew in generated outputs that favors or disfavors particular perspectives, groups, or outcomes.
- code securityCode security is the degree to which software code protects systems and data against unauthorized access, misuse, or compromise.
- copyrightCopyright is a legal protection granting creators exclusive rights over specified uses of original expressive works, including software code.
- atomic typeAn atomic type is a type whose supported accesses and operations are indivisible with respect to concurrent execution and provide defined synchronization semantics.
- filecmp.cmpfilecmp.cmp is a Python function that compares two files and reports whether their contents appear equivalent under its comparison settings.
- os.listdiros.listdir is a Python function that returns the names of entries in a specified filesystem directory.
- shutil.copyA Python function that copies a file to a destination while preserving the file's contents and basic metadata where supported.
- function declarationA function declaration is a source-language construct that specifies a function’s name and parameter interface, and may include its implementation.
- black-box testingClosed-box testing is software testing that evaluates externally observable behavior without relying on knowledge of the implementation's internal structure.
- programming languageA programming language is a formal language for expressing instructions and algorithms that a computer can execute, directly or through translation.
- joinThe Python string join method concatenates the elements of an iterable into one string with the receiving string between adjacent elements.
- newlineA newline is a character or character sequence that marks the boundary between consecutive lines of text.
- magic numberA magic number is an unexplained numeric literal embedded directly in code instead of being represented by a named parameter or variable.
- Visual Studio CodeVisual Studio Code is a source-code editor with extensibility features for programming, debugging, and development workflows.
- ChatGPTChatGPT is a conversational artificial-intelligence system that generates responses to natural-language prompts using large language models.
- plus operatorThe plus operator is a language-defined operation, commonly performing numeric addition, string concatenation, or collection combination according to operand types.
- string repetition operatorA string repetition operator is a language operation that produces a string by repeating another string a specified integer number of times.
- empty stringAn empty string is a string value containing zero characters.
- persona patternA persona pattern is a prompting technique that instructs an AI system to respond from a specified role or point of view.
- automationAutomation is the technique of having software perform repetitive or otherwise routine work with limited human effort.
- code suggestionA code suggestion is a proposed source-code completion or generation presented to a programmer for possible acceptance.
- commentA source-code annotation that is ignored during program execution and can provide human-readable information or instructions.
- temperature conversionTemperature conversion is the calculation of an equivalent temperature value between defined temperature scales.
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.
