Index
A
- abs function, Arithmetic Functions
- absolute paths, Filenames and Paths
- accumulators, Accumulating a List
- Ackermann function, writing function that evaluates, Exercise
- add method, Sets
- __add__ method, Operator Overloading
- addition operator (+), Arithmetic Operators
- addition, Counter objects, Counters
- add_method_to command, Another Method
- aliasing, Aliasing
- created by passing reference to object as function argument, List Arguments
- all function, any and all
- anagrams, Storing Data Structures
- anaspeptic, Making a Word List
- and operator, Logical Operators, Nested Conditionals
- any function, any and all
- apostrophe (') inside strings, Strings
- append method, List Methods, Making a Word List, Add, Remove, Shuffle, and Sort
- arc function, Refactoring
- argument packing, Argument Packing-Argument Packing
- arguments, Arguments
- arithmetic expressions
- arithmetic functions, Arithmetic Functions-Arithmetic Functions
- arithmetic operators, Arithmetic Operators-Expressions, Glossary
- assert statements, Debugging
- assertEqual method, Debugging
- AssertionError, Debugging
- assignment operator (=), Encapsulation and Generalization
- assignment statements, Variables
- assignments
- asterisk (*) operator, Arithmetic Operators
- AttributeError, But Tuples Are Immutable
- attributes, Debugging, Attributes-Objects as Return Values
B
- backward slash (\) in file paths on Windows, Filenames and Paths
- base 60, Design-First Development
- bigrams, Bigrams-Bigrams
- binary mode, Checking for Equivalent Files
- bitwise XOR operator (^), Arithmetic Operators
- blocks, if Statements
- body (function), Defining New Functions
- boolean expressions, Boolean Expressions-Logical Operators
- boolean functions, Boolean Functions
- writing is_between function (exercise), Exercise
- boolean values, The in Operator
- bracket operator ([]), A String Is a Sequence, Strings Are Immutable
- branches (conditional statements), The else Clause
- break statements, Writing Files
- bugs, Debugging, Glossary
C
- call graph for fibonacci function, Memos
- canvas, The jupyturtle Module, Creating a Line
- captions.dat file, Shelve
- captions.dir file, Shelve
- cards, representing, Representing Cards-Card Attributes, Decks
- caret (^)
- Cartesian coordinates, Creating a Point
- category function, Punctuation
- chained conditionals, Chained Conditionals
- characters, A String Is a Sequence
- chatbots, asking questions about Python, Ask a Virtual Assistant
- child class, Parents and Children
- choice function, Random Numbers, Generating Text
- choices function, weights and k optional arguments, Random Numbers
- circle, drawing, Approximating a Circle
- class variables, Representing Cards, Printing Cards
- classes, Programmer-Defined Types
- close method, Writing Files
- collections module, Counters
- colon (:), slice operator (see slice operator; slices)
- comma-separated list of values in tuples, Tuples Are Like Lists
- commas between groups of digits, Values and Types
- comments, Comments
- comparing and sorting tuples, Comparing and Sorting-Comparing and Sorting
- comparison operators, Boolean Expressions
- (see also relational operators)
- use with sets, Sets
- compound data structures, Debugging
- computer scientists, Programming as a Way of Thinking
- concatenation, Glossary
- concatenation operator (+), Strings, Exercise
- conditional expressions, Conditional Expressions
- conditional statements, if Statements, Conditional Expressions
- config dictionary, YAML
- writing to YAML file, YAML
- configuration data, YAML
- coordinates, Creating a Point
- copy function, Copying, Pure Functions, Creating a Point
- copy module, Copying
- copying a dictionary, Creating Dictionaries
- count method, Find and Replace
- counters, Looping and Counting, Comparing and Sorting, Counters
- counts
- curly braces ({})
- current working directory, Filenames and Paths
D
- data directory, listing contents, Shelve
- data structures, Debugging
- databases, Files and Databases
- datasets, large, debugging, Debugging
- db.close function, Shelve
- DbfilenameShelf object, Shelve
- dead code, Return Values and Conditionals, Ask a Virtual Assistant
- debugging, Debugging, Glossary, Debugging, Debugging
- avoiding modifying objects, Debugging
- avoiding sharing objects, Debugging
- checking invariants, Debugging
- of data structures, Debugging
- functions for testing and debugging programs containing objects, Debugging
- of functions that aren't working, Debugging
- functions, pre- and postconditions, Debugging
- of inheritance in programs, Debugging
- of large datasets, Debugging
- list comprehensions more difficult than loops, List Comprehensions
- of list method calls, Debugging
- of more substantial programs, Debugging
- reading and writing files, problems with whitespace, Debugging
- of reading and writing files, Debugging
- of syntax or runtime errors, Debugging
- testing function using doctest, Debugging
- using assert statement, Debugging
- using unittest, Debugging
- decks of cards, Decks
- adding, removing, shuffling, and sorting cards, Add, Remove, Shuffle, and Sort-Add, Remove, Shuffle, and Sort
- hand versus, Parents and Children
- printing the deck, Printing the Deck
- decrements, Updating Variables
- deep copy, Deep Copy-Polymorphism
- deepcopy function, Deep Copy
- def keyword, Defining New Functions
- default value, Optional Parameters
- defaultdict, defaultdict-Conditional Expressions
- definition (function), Defining New Functions
- delay argument (make_turtle), Approximating a Circle
- delegation, Add, Remove, Shuffle, and Sort
- delimiters
- deserialization, YAML
- design-first development, Design-First Development-Design-First Development
- deterministic computer programs, Random Numbers
- development plan, A Development Plan
- dict function, Creating Dictionaries, Zip
- dictionaries, Dictionaries, Tuple Assignment
- attributes and their values in, Debugging
- creating, Creating Dictionaries
- creating dictionary of lists using defaultdict, defaultdict
- creating using zip and dict, Zip
- debugging, Debugging
- debugging, using structshape, Debugging
- defaultdict and, defaultdict
- dictionary in BridgeHand class variable, Specialization
- dictionary mapping from keywords to values, Packing Keyword Arguments
- dictionary with x and y keys, using unpack operator to create Point object, Packing Keyword Arguments
- in expressions in f-strings, f-strings
- inverting to look up value and get corresponding key, Inverting a Dictionary
- of keyword arguments, Packing Keyword Arguments
- lists and, Lists and Dictionaries
- mapping from each bigram to number of times it appears, Bigrams
- mapping from each word to list of words following, Markov Analysis
- as mappings, A Dictionary Is a Mapping-A Dictionary Is a Mapping
- memos in, Memos
- similarities and differences of Counter objects to, Counters
- similarity of shelf objects to, Shelve
- storing unique punctuation marks in a dictionary, Punctuation
- subtraction, Sets
- tuples used as keys in, But Tuples Are Immutable
- unique words stored as key in, Unique Words
- using choice function with, Random Numbers
- using for loop with, Looping and Dictionaries
- using in operator on, The in Operator-A Collection of Counters
- using to build a list, Accumulating a List-Accumulating a List
- using to check for duplicates in a sequence, Sets
- using with counters, A Collection of Counters
- words stored as keys, subtracting invalid words, Dictionary Subtraction
- digests, Checking for Equivalent Files
- directories
- distance function, defining, Incremental Development-Incremental Development
- division operator (/), Arithmetic Operators
- divmod function, Tuples as Return Values, Argument Packing, Prototype and Patch, Design-First Development
- docstrings, Docstrings
- doctests, Doctest, Debugging
- dollar sign ($)
- dot operator (.), The import Statement, Attributes
- double asterisk (**) operator, Packing Keyword Arguments
- double underscores (__) beginning and ending special method names, The __str__ Method
- draw method, Creating a Line, Creating a Rectangle
- dump function, YAML
- duplicates, Exercise, YAML
- dictionary checking for duplicates in a sequence, Sets
- searching for duplicate photos, Exercise
E
- elements (list), A List Is a Sequence
- elements (set), uniqueness of, Sets
- elif clause, Chained Conditionals
- else clause (in if statements), The else Clause
- empty lists, A List Is a Sequence
- empty strings
- encapsulation, Encapsulation and Generalization, A Development Plan
- encoding, Representing Cards
- end (keyword argument), Loops and Strings
- endswith method, Writing Files
- enumerate function, Zip
- enumerate object, Zip
- ephemeral programs, Files and Databases
- __eq__ method, Equivalence and Identity, Comparing Cards
- equality operator (==), Boolean Expressions, Boolean Functions, Equivalence and Identity
- equivalence, Equivalence and Identity, Comparing Cards
- equivalent versus identical lists, Objects and Values
- error messages, Debugging
- errors
- evaluation of expressions, Expressions and Statements
- exclamation point (!) preceding shell commands, Debugging
- execution of statements, Expressions and Statements
- exponentiation operator (**), Arithmetic Operators, The import Statement
- expressions, Expressions, Glossary, Expressions and Statements
- extend method, List Methods
- extra features in Python, Python Extras
F
- f-strings, f-strings-YAML
- dot operator in an expression in f-string, Attributes
- using to create string representation of a line, Creating a Line
- using to write function displaying value of time objects, Attributes
- factorial function, Recursion with Return Values
- factory functions, defaultdict
- fibonacci function, Fibonacci, Memos
- file object, Reading the Word List
- files
- checking for equivalent files, Checking for Equivalent Files-Checking for Equivalent Files
- filenames and paths, Filenames and Paths-Filenames and Paths
- programs reading and writing text to, Files and Databases
- reading and writing text files, Writing Files-Writing Files
- reading and writing, debugging of, Debugging, Debugging
- reading file into a string, Making a Word List
- writing to text files using f-strings, f-strings-YAML
- YAML files storing configuration data, YAML
- file_object.readline method, Reading the Word List
- filtering, Accumulating a List
- find and replace, Find and Replace
- find_defining_class function, Debugging
- float function, Values and Types
- converting string with digits and decimal point to floating-point number, Values and Types
- float type, Values and Types
- floating-point numbers, Glossary
- floor division, Arithmetic Operators, Integer Division and Modulus
- flow of execution, Recursion with Return Values, Debugging
- for keyword, Repetition
- for loops
- exercise with, Exercise
- identifying unique words in a book, Punctuation
- looping through keys in shelf object, Shelve
- looping through lists, Looping Through a List
- storing unique punctuation marks in a dictionary, Punctuation
- tuple assignment in, Tuple Assignment
- using file object in, Reading the Word List
- using in making square, Making a Square
- using instead of recursive functions, Recursion
- using to display letters in a string, Loops and Strings
- using to make a word list, Making a Word List
- using to read lines from file, Unique Words
- using with dictionaries, Looping and Dictionaries
- for statement, Repetition
- formal languages, Formal and Natural Languages, Glossary
- format specifiers, Attributes
- forward function, The jupyturtle Module
- forward slash (/) separating directory and filenames in path on macOS and Unix systems, Filenames and Paths
- frames, Stack Diagrams
- function calls, Arithmetic Functions, Glossary
- function name as expression, Arithmetic Functions
- function object, Defining New Functions, Walking Directories
- functional programming style, Pure Functions
- functions, Glossary, Functions
- adding parameters or generalization, Encapsulation and Generalization
- advantages of, Why Functions?
- arguments, Arguments
- asking virtual assistant to write and debug, Ask a Virtual Assistant
- assuming they work correctly and return right results, Leap of Faith
- boolean, Boolean Functions
- calling, Calling Functions
- calling other functions, Calling Functions
- debugging, pre- and postconditions, Debugging
- defining new functions, Defining New Functions
- design of, interface and implementation, A Development Plan
- docstring explaining the interface, Docstrings
- drawing a circle, Approximating a Circle
- encapsulating code in, Encapsulation and Generalization
- encapsulating loop in a function, Loops and Strings
- encapsulation and generalization, A Development Plan, Exercise
- for loop inside of, Repetition
- having no return values, And Some Have None-And Some Have None
- having return values, Return Values-Some Functions Have Return Values, Return Values and Conditionals
- with infinite recursion, Infinite Recursion
- local variables and parameters in, Variables and Parameters Are Local
- in math module, The import Statement
- optional parameters, Optional Parameters
- parameters, Parameters
- pure, Pure Functions
- recursive, Recursion
- refactoring circle function, Refactoring
- repetition using for statement, Repetition
- stack diagrams of, Stack Diagrams
- testing with doctest, Debugging
- tracebacks of runtime errors, Tracebacks
G
- __ge__ method, Comparing Cards
- generalization (functions), Encapsulation and Generalization, Refactoring, A Development Plan
- generator expressions, List Comprehensions
- getcwd function, Filenames and Paths
- greater than operator (>), Boolean Expressions, Comparing Cards
- greater than or equal to operator (>=), Boolean Expressions, Comparing Cards
- greatest common divisor (GCD), writing function for, Exercise
- group function, Regular Expressions
- grow method, Changing Rectangles
- __gt__ method, Comparing Cards
H
- hand of cards, Parents and Children
- hasattr function, Debugging
- hash functions, Checking for Equivalent Files
- HASH object, Checking for Equivalent Files
- hash tables, The in Operator
- hashes, Lists and Dictionaries
- hashlib module, Checking for Equivalent Files
- has_duplicates function, Sets
- !head command, Debugging
- header (function), Defining New Functions
- hexadecimal numbers, Programmer-Defined Types
- hexdigest function, Checking for Equivalent Files
- hyphen (-), word boundary delimiter, Lists and Strings
- hypotenuse of right triangle, writing function for length of (exercise), Exercise
I
- identical versus equivalent lists, Objects and Values
- identity, Equivalence and Identity
- if keyword, if Statements
- if statements, Conditionals and Recursion, if Statements, The in Operator
- immutability
- implementation (function), A Development Plan
- import statements, The import Statement, Expressions and Statements
- in keyword, Repetition
- in operator, The in Operator
- incremental development, Incremental Development-Incremental Development
- increments, Updating Variables
- IndentationError, Debugging
- IndexError, A String Is a Sequence, Lists Are Mutable
- indexes, A String Is a Sequence
- infinite recursion, Infinite Recursion, Checking Types
- inheritance, Inheritance
- advantages and disadvantages of, Debugging
- Card attributes, Card Attributes
- comparing Card objects, Comparing Cards-Comparing Cards
- debugging programs that use, Debugging
- deck of cards, adding, removing, shuffling, and sorting cards, Add, Remove, Shuffle, and Sort-Add, Remove, Shuffle, and Sort
- defining objects representing decks of cards, Decks
- demonstrating using classes representing playing cards, Representing Cards-Card Attributes
- parents and children, Parents and Children-Parents and Children
- printing Card objects, Printing Cards
- printing the deck, Printing the Deck
- specialization, Bridgehand inheriting from Hand class, Specialization
- __init__ method, The __init__ Method, Operator Overloading, Creating a Line, Creating a Rectangle, Card Attributes
- initializing variables, Updating Variables
- input function, Keyboard Input
- input validation, Checking Types
- instance methods, Static Methods
- instances, Programmer-Defined Types, Printing Cards
- instantiation, Programmer-Defined Types
- int function, Values and Types, Keyboard Input
- int type, Values and Types
- integer division, Arithmetic Operators, Integer Division and Modulus
- integer division (//) operator, Arithmetic Operators, Glossary
- integers, Glossary
- interface design, A Development Plan, Glossary
- interpreter, using as calculator, Exercise
- intersection, Counters
- invariants, Debugging
- invocation (method), String Methods
- is operator, Objects and Values, Copying
- isdir function, Filenames and Paths
- isfile function, Filenames and Paths
- isinstance function, Checking Types, Debugging
- items (dictionary), A Dictionary Is a Mapping
- items method, Tuple Assignment, Word Frequencies, Shelve
K
- key-value pairs in dictionary items, A Dictionary Is a Mapping, Creating Dictionaries
- key-value pairs in shelf objects, Shelve, Storing Data Structures
- key-value stores, Shelve
- keyboard input, Keyboard Input
- KeyError, A Dictionary Is a Mapping
- keys method, Shelve
- keyword arguments, Encapsulation and Generalization
- keywords, Variable Names, Ask a Virtual Assistant
- Koch curve, Exercise
- kwargs parameter, Packing Keyword Arguments
L
- Large Language Model (LLM), Text Analysis and Generation
- __le__ method, Comparing Cards
- leap of faith, Leap of Faith
- left function, The jupyturtle Module
- len function, Strings, Exercise, A String Is a Sequence
- less than operator (<), Boolean Expressions, Comparing and Sorting, Comparing Cards
- less than or equal to operator (<=), Boolean Expressions, Comparing Cards
- checking if one set is subset of another, Sets
- Line class, Creating a Line
- Line objects
- linear search, Search
- lines, Writing Files
- Liskov substitution principle, Parents and Children
- Liskov, Barbara, Parents and Children
- list comprehensions, List Comprehensions-List Comprehensions
- list function, List Slices, Lists and Strings, Exercise
- listdir function, Filenames and Paths, Walking Directories
- lists, Lists
- aliasing, Aliasing
- building, using a dictionary, Accumulating a List-Accumulating a List
- converting to strings, Sorting Lists
- creating dictionary of lists using defaultdict, defaultdict
- debugging list method calls, Debugging
- debugging, using structshape, Debugging
- defaultdict creating new list, defaultdict
- in dictionaries, Lists and Dictionaries
- in expressions in f-strings, f-strings
- list of pairs using zip and list, Zip
- looping through, Looping Through a List
- making a word list, Making a Word List
- methods of, List Methods
- mutability of, Lists Are Mutable
- objects and values, Objects and Values
- operators used with, List Operations
- as sequences, A List Is a Sequence
- similarity of tuples to, Tuples Are Like Lists-Tuples Are Like Lists
- slices of, List Slices
- sorting, Sorting Lists
- strings and, Lists and Strings
- of strings, concatenating into single string, Lists and Strings
- use as function arguments, List Arguments
- window list of bigrams, Bigrams
- LLM (Large Language Model), Text Analysis and Generation
- local variables, Variables and Parameters Are Local, Some Functions Have Return Values
- logical operators, Logical Operators
- loop variable, Loops and Strings, List Comprehensions
- loops, Repetition
- lower method, The in Operator
- lowercase and uppercase letters, handling by Python, String Comparison
- __lt__ method, Comparing Cards, Add, Remove, Shuffle, and Sort
M
- main function, running for unittest, Debugging
- makedirs function, Shelve
- make_cards static method, Decks
- make_turtle function, The jupyturtle Module, Creating a Rectangle
- mapping, A Dictionary Is a Mapping
- Markov chain text analysis, Markov Analysis-Markov Analysis
- Markov text generation, Text Analysis and Generation, Random Numbers
- Match objects, Regular Expressions
- math module, The import Statement
- math.pow function, The import Statement
- math.sqrt function, Incremental Development
- max function, Comparing and Sorting
- md5 function, Checking for Equivalent Files
- md5_digest function, Checking for Equivalent Files
- mean function, Argument Packing, Packing Keyword Arguments
- memos, Memos
- method resolution order (mro) method, Debugging
- methods, Reading the Word List
- child class method overriding parent method, Parents and Children
- defining, Defining Methods-Defining Methods
- defining translate method and adding to Point, Creating a Point
- inheritance of, Parents and Children, Parents and Children
- problems finding their definitions, Debugging
- invocation, String Methods
- list, List Methods
- special
- static, Static Methods-Comparing Time Objects
- string, String Methods
- time_to_int function rewritten as method, Another Method
- translated method, defining and adding to Point, Creating a Point
- min function, Comparing and Sorting
- min_max function, Tuples as Return Values, Argument Packing
- modules, The import Statement
- importing doctest module and running function, Doctest
- modulus operator (%), Integer Division and Modulus
- most_common method, Counters
- moveto function, Creating a Line
- move_cards method, Parents and Children
- mro (method resolution order) method, Debugging
- multiline strings, Docstrings
- multiplication operator (*), Arithmetic Operators
- mutability
N
- n-grams, Bigrams
- named arguments (see keyword arguments)
- named tuples, Named Tuples-Named Tuples
- natural languages, Formal and Natural Languages, Glossary
- __ne__ method, Comparing Cards
- negative numbers, absolute value of, Arithmetic Functions
- nested conditionals, Nested Conditionals
- nested lists, A List Is a Sequence
- newline character (\n), Keyboard Input, Reading the Word List
- newlines, Glossary, f-strings, Debugging
- nondeterministic computer programs, Random Numbers
- None value, And Some Have None, Regular Expressions
- NoneType object, Debugging
- not equal operator (!=), Boolean Expressions, Comparing Cards
- not operator, Logical Operators
- number sequence, enclosing in quotes, Values and Types
O
- object diagrams, Attributes
- object-oriented languages, Classes and Methods
- object-oriented programming (OOP), Classes and Functions, Classes and Objects
- objects, Programmer-Defined Types
- aliased, Aliasing
- avoiding sharing and modification of, Debugging
- comparing Time objects, Comparing Time Objects
- converting to strings, The __str__ Method
- copying, Copying
- debugging programs that work with, Debugging
- equivalence and identity, Equivalence and Identity
- as function arguments, Attributes
- initializing attributes of new object using __init__, The __init__ Method
- methods, Reading the Word List
- mutability of, Objects Are Mutable
- passed to pure functions as arguments, Pure Functions
- Point object, instantiating and displaying, Creating a Point
- polymorphism, Polymorphism
- receiver of method invocations, Defining Methods
- references to, Aliasing
- as return values, Objects as Return Values
- serializing and deserializing, YAML
- string, Strings Are Immutable
- values and, Objects and Values
- open function, Reading the Word List
- operands, Values and Types, Glossary
- operating systems
- operators
- optional arguments, handling using conditional expressions, Conditional Expressions
- optional parameters, Optional Parameters
- or operator, Logical Operators
- order of operations, Expressions
- os module, Filenames and Paths
- os.getcwd function, Filenames and Paths
- os.listdir function, Filenames and Paths, Walking Directories
- os.makedirs function, Shelve
- os.path.exists function, Filenames and Paths
- os.path.isdir function, Filenames and Paths
- os.path.isfile function, Filenames and Paths
- os.path.join function, Shelve
P
- packing arguments into a tuple, Argument Packing
- pairs of values in sequences, looping through using zip object, Zip
- palindromes, Exercise
- parameters, Parameters
- parent class, Parents and Children
- parentheses ()
- pass statements, if Statements
- patching code, Prototype and Patch-Prototype and Patch
- paths, Filenames and Paths
- pattern matching, Regular Expressions
- (see also regular expressions)
- patterns, Regular Expressions
- pendown function, Exercises
- penup function, Exercises
- persistent programs, Files and Databases
- Point objects
- points
- polygon function, Approximating a Circle
- polyline function, Refactoring
- polymorphism, Polymorphism, Parents and Children
- pop method, List Methods, Add, Remove, Shuffle, and Sort
- positive numbers, absolute value of, Arithmetic Functions
- postconditions, Debugging
- pound symbol (#), comments beginning with, Comments
- pow function, The import Statement
- pprint function, Debugging
- preconditions, Debugging
- print function, The print Function, Debugging
- print statements
- programmer-defined types
- programming, Programming as a Way of Thinking
- programming languages, Formal and Natural Languages
- prompt (>>>), Doctest
- prototype and patch, Prototype and Patch-Prototype and Patch
- pseudorandom numbers, Random Numbers
- punctuation, identifying and removing from text, Punctuation-Punctuation
- pure functions, And Some Have None, Incremental Development, Pure Functions
- Pythagorean theorem, Incremental Development
R
- random module, Random Numbers, Add, Remove, Shuffle, and Sort
- random sequence of words, generating, Random Numbers
- range function, Loops and Strings
- raw strings, Glossary
- re (regular expressions) module, Regular Expressions
- read method, Making a Word List
- readers, Writing Files
- readline function, Reading the Word List
- receiver, Defining Methods
- rectangles
- recursion, Recursion
- RecursionError, Infinite Recursion
- recursive functions, Recursion
- redirect operator (>), Debugging
- refactoring code, Refactoring
- references, Aliasing
- regular expressions, Regular Expressions-String Substitution
- relational operators, Boolean Expressions
- relative paths, Filenames and Paths
- remainder, Integer Division and Modulus, Tuples as Return Values
- remove method, List Methods, Debugging, Argument Packing
- repetition operator (*), Exercise
- repetition, using for statement, Repetition
- replace method, Find and Replace
- repr function, Debugging
- return character (\r), Debugging
- return statements, Some Functions Have Return Values
- return values
- reverse order, sorting in, Word Frequencies
- reversed function, Exercise
- right function, The jupyturtle Module
- round function, Arithmetic Functions
- rubber duck debugging, Debugging
- runtime errors, Debugging
- run_doctests function, Doctest
- run_unittest function, Debugging
S
- scaffolding, Incremental Development
- searches
- self parameter, Defining Methods, Another Method, Static Methods
- semantic errors, Debugging
- sequences, Strings and Regular Expressions
- serialization, YAML
- set subtraction, Dictionary Subtraction
- sets, Sets-Sets
- sexagesimal numbers, Design-First Development
- shallow copy, Deep Copy
- shapes, Polymorphism
- shelf object, Shelve
- shell commands, !tail and !head, Debugging
- shelve module, Shelve-Shelve
- shelve.open function, Shelve
- shuffle function, Add, Remove, Shuffle, and Sort
- SierpiĆski triangle, Exercise
- slice operator (:), List Slices
- slices
- sort key, Comparing and Sorting
- sort method, Add, Remove, Shuffle, and Sort
- sorted function, Sorting Lists, Comparing and Sorting, Unique Words
- space characters controlling indentation of output, Debugging
- spaces, Debugging
- span function, Regular Expressions
- special methods, The __str__ Method
- specialization, Specialization
- spellcheck, Dictionary Subtraction
- split method, Lists and Strings, Looping Through a List
- sqrt function, Incremental Development
- square brackets ([]), A List Is a Sequence
- square, creating using make_turtle, Making a Square
- stack diagrams, Stack Diagrams
- startswith method, Writing Files
- state diagrams, State Diagrams
- statements, Variables, Expressions and Statements
- static methods, Static Methods-Comparing Time Objects
- str function, Values and Types, f-strings
- str type, Values and Types
- __str__ method, The __str__ Method, Operator Overloading, Creating a Line, Creating a Rectangle, Printing Cards
- string substitution, String Substitution
- strings, Strings, Glossary
- checking if character appears in, The in Operator
- comparisons of, String Comparison
- converting letters in to lowercase, The in Operator
- converting lists to, Sorting Lists
- f-string expressions converted to, f-strings
- finding and replacing character sequences in, Find and Replace
- finding character sequences in using regular expressions, Regular Expressions-String Substitution
- for loop displaying letters in, Loops and Strings
- getting last letter of, A String Is a Sequence
- immutability of, Strings Are Immutable
- lists and, Lists and Strings
- lists of, A List Is a Sequence
- lists of, concatenating into single string, Lists and Strings
- methods of, String Methods
- multiline, enclosed in triple quotes, Docstrings
- objects and values, Objects and Values
- operators and methods, reading and writing files with, Writing Files-Writing Files
- printing value of, The print Function
- reading a file into a string, Making a Word List
- returned by readline function, Reading the Word List
- searching for letters in, Search
- selecting a character from, A String Is a Sequence
- slices of, String Slices
- sorting letters in, using sorted function, Sorting Lists
- string methods versus list methods, Debugging
- stripping newline and whitespace from words, Reading the Word List
- writing combination of strings and other values using f-string, f-strings
- strip method , Reading the Word List
- removing punctuation from beginning and end of words, Punctuation
- structshape function, Debugging
- structshape module, Debugging
- sub function, String Substitution
- subtract function, Dictionary Subtraction
- subtraction operator (-), Arithmetic Operators
- subtraction, Counter objects, Counters
- sum function, List Operations
- syntax errors, Arithmetic Functions, Glossary, Debugging, Debugging
T
- tabs, Debugging
- !tail command, Debugging
- test discovery, Debugging
- test failing in unittest, Debugging
- TestCase class, Debugging
- testing
- text analysis
- text generation
- thinking, programming as way of, Programming as a Way of Thinking
- time function, Exercise
- TODO (in comments), if Statements
- total, initializing and incrementing, Looping and Counting
- totally ordered, Comparing Cards
- tracebacks, Tracebacks
- translate method, Changing Rectangles
- trigrams, Bigrams
- trimmed mean, Argument Packing
- True and False values (bool type), Boolean Expressions
- tuple function, Tuples Are Like Lists
- tuples, Tuples
- argument packing, Argument Packing-Argument Packing
- assignment, Tuple Assignment-Tuple Assignment
- comparing and sorting, Comparing and Sorting-Comparing and Sorting
- comparisons of, Comparing Cards
- debugging, using structshape, Debugging
- immutability of, But Tuples Are Immutable
- namedtuple, Named Tuples-Named Tuples
- packing arguments into, Packing Keyword Arguments
- as return values, Tuples as Return Values
- similarity to lists, Tuples Are Like Lists-Tuples Are Like Lists
- using zip with, Zip-Comparing and Sorting
- Turing complete, Recursion with Return Values
- Turtle object, Creating a Line
- type function, Values and Types
- TypeError, Arguments
- types, Values and Types-Formal and Natural Languages, Glossary
U
- underscores (_)
- unicodedata module, Punctuation
- union method, Sets, Counters
- unittest module, Debugging
- unpack operator (**), Packing Keyword Arguments
- unpacking arguments in tuples, Argument Packing
- update function (HASH), Checking for Equivalent Files
- updates, updating variables with assignments, Updating Variables
- upper method, String Methods
- uppercase and lowercase letters, handling by Python, String Comparison
- UTC (Coordinated Universal Time), Exercise
V
- value-frequency pairs, Counters
- ValueError, Keyboard Input, Debugging
- values, Glossary
- values method, The in Operator, Looping and Dictionaries, Shelve
- variables, Variables
- association with an object (reference), Aliasing
- class, Representing Cards
- contained by index in brackets, A String Is a Sequence
- created by running statements, Variables
- index in brackets, A String Is a Sequence
- initializing, Updating Variables
- local variables in a function, Variables and Parameters Are Local
- names of, comments and, Comments
- naming, Variable Names
- representing with state diagrams, State Diagrams
- returned values assigned to, Some Functions Have Return Values
- in tuple assignments, Tuple Assignment
- updating, Updating Variables
- use as function arguments, Parameters
- vars function, Debugging
- vertical bar (|) in regular expressions, Regular Expressions, String Substitution
- virtual assistants