Practice of Computing Using Python 2nd Edition Punch Solutions Manual
Product details:
- ISBN-10 : 0132830205
- ISBN-13 : 978-0132830201
- Author:
Now in its Third Edition, Practice of Computing Using Pythoncontinues to effectively introduce readers to computational thinking using Python, with a strong emphasis on problem solving through computer science. The authors have chosen Python for its simplicity, powerful built-in data structures, advanced control constructs, and practicality. The text is built from the ground up for Python programming, rather than having been translated from Java or C++.
Focusing on data manipulation and analysis as a theme, the text allows readers to work on real problems using Internet-sourced or self-generated data sets that represent their own work and interests. The authors also emphasize program development and provide readers of all backgrounds with a practical foundation in programming that suit their needs. Among other changes, theThird Edition incorporates a switch to the Anaconda distribution, the SPYDER IDE, and a focus on debugging and GUIs.
Table contents:
- Part 1 Thinking About Computing
- Chapter 0 The Study of Computer Science
- 0.1 Why Computer Science?
- 0.1.1 Importance of Computer Science
- 0.1.2 Computer Science Around You
- 0.1.3 Computer “Science”
- Theory of Computation
- Computational Efficiency
- Algorithms and Data Structures
- Parallel Processing
- Software Engineering
- Many Others
- 0.1.4 Computer Science Through Computer Programming
- 0.2 The Difficulty and Promise of Programming
- 0.2.1 Difficulty 1: Two Things at Once
- Poetry to Programming?
- 0.2.2 Difficulty 2: What Is a Good Program?
- It’s All About Problem Solving
- A Program as an Essay
- 0.2.3 The Promise of a Computer Program
- 0.3 Choosing a Computer Language
- 0.3.1 Different Computer Languages
- 0.3.2 Why Python?
- Python Philosophy
- A “Best Practices” Language
- Python Is Open Source
- A rising tide lifts all boats
- 0.3.3 Is Python the Best Language?
- 0.4 What Is Computation?
- 0.5 What Is a Computer?
- 0.5.1 Computation in Nature
- The Human Brain
- Evolutionary Computation
- 0.5.2 The Human Computer
- 0.6 The Modern, Electronic Computer
- 0.6.1 It’s the Switch!
- 0.6.2 The Transistor
- Smaller Size
- Quantity and Function
- Faster
- 0.7 A High-Level Look at a Modern Computer
- 0.8 Representing Data
- 0.8.1 Binary Data
- 0.8.2 Working with Binary
- 0.8.3 Limits
- Bits, Bytes, and Words
- 0.8.4 Representing Letters
- 0.8.5 Representing Other Data
- Images
- Music
- 0.8.6 What Does a Number Represent?
- 0.8.7 How to Talk About Quantities of Data
- 0.8.8 How Much Data Is That?
- 0.9 Overview of Coming Chapters
- Summary
- Part 2 Starting to Program
- Chapter 1 Beginnings
- 1.1 Practice, Practice, Practice
- 1.2 Quickstart, the Circumference Program
- 1.2.1 Examining the Code
- 1.3 An Interactive Session
- 1.4 Parts of a Program
- 1.4.1 Modules
- 1.4.2 Statements and Expressions
- 1.4.3 Whitespace
- Indentation
- Continuation
- 1.4.4 Comments
- 1.4.5 Special Python Elements: Tokens
- Keywords
- Operators
- Punctuators and Delimiters
- Literals
- 1.4.6 Naming Objects
- 1.4.7 Recommendations on Naming
- 1.5 Variables
- 1.5.1 Variable Creation and Assignment
- Check Yourself: Variables and Assignment
- 1.6 Objects and Types
- 1.6.1 Numbers
- Integers
- Floating-Point Numbers
- Fractions
- 1.6.2 Other Built-In Types
- Boolean
- String
- List
- Dictionary
- Set
- 1.6.3 Object Types: Not Variable Types
- 1.6.4 Constructing New Values
- 1.7 Operators
- 1.7.1 Integer Operators
- 1.7.2 Floating-Point Operators
- 1.7.3 Mixed Operations
- 1.7.4 Order of Operations and Parentheses
- 1.7.5 Augmented Assignment Operators: A Shortcut!
- Check Yourself: Types and Operators
- 1.8 Your First Module, Math
- 1.9 Developing an Algorithm
- 1.9.1 New Rule—Testing
- 1.10 Turtle Graphics
- 1.11 What’s Wrong with My Code?
- Summary
- Elements
- Built-in Types
- Rules
- Exercises
- Programming Projects
- Chapter 2 Control
- 2.1 QuickStart Control
- 2.1.1 Selection
- 2.1.2 Booleans for Decisions
- 2.1.3 The if Statement
- The Basic if Statement
- Indentation and a Suite of Python Code
- The if-else Statement
- 2.1.4 Example: What Lead Is Safe in Basketball?
- 2.1.5 Repetition
- Basic While
- Iteration: The Basic for Statement
- 2.1.6 Example: Finding Perfect Numbers
- Program to Evaluate Whether a Number Is Perfect
- A Note on Naming
- Putting It All Together
- 2.1.7 Example: Classifying Numbers
- The Process of Changing a Program
- Looking at a Range of Numbers
- Summing Divisors
- Classify the Numbers
- Check Yourself: Basic Control Check
- 2.2 In-Depth Control
- 2.2.1 True and False: Booleans
- 2.2.2 Boolean Variables
- 2.2.3 Relational Operators
- What Does It Mean to be Equal?
- Chained Relational Operators
- 2.2.4 Boolean Operators
- 2.2.5 Precedence
- 2.2.6 Boolean Operators Example
- Check Yourself: Loop Control Check
- 2.2.7 Another Word on Assignments
- Multiple Assignment
- Swap
- 2.2.8 The Selection Statement for Decisions
- 2.2.9 More on Python Decision Statements
- The if-elif-else Statement
- Mixing and Matching elif and else
- Updating Our Perfect Number Example
- 2.2.10 Repetition: the while Statement
- Basic Repetition and the while Loop
- Loop Control and Initialization
- Check Yourself: More Control Check
- else and break
- Break Statement and Non-Normal Exit
- More Control Inside of a while Loop
- Continue
- Checking User Input for Errors
- The pass Statement
- 2.2.11 Sentinel Loop
- 2.2.12 Summary of Repetition
- 2.2.13 More on the for Statement
- Using range to Generate a Number Sequence
- The range Function and Iterables
- Equivalence of while and for
- Refactor Perfect Numbers Using for
- 2.2.14 Nesting
- Check Yourself: for and range Check
- 2.2.15 Hailstone Sequence Example
- 2.3 Plotting Data with pylab
- 2.3.1 First Plot and Using a List
- 2.3.2 More Interesting Plot: A Sine Wave
- Plotting Elements and Their Colors
- More Detailed Call of Plot
- 2.4 Computer Science Perspectives: Minimal Universal Computing
- 2.4.1 Minimal Universal Computing
- 2.5 What’s Wrong with My Code?
- Summary
- Selection: if-elif-else
- Repetition: while
- Iteration: for
- Rules
- Exercises
- Programming Projects
- Chapter 3 Algorithms and Program Development
- 3.1 What Is an Algorithm?
- 3.1.1 Example Algorithms
- 3.2 Algorithm Features
- 3.2.1 Algorithm versus Program
- 3.2.2 Qualities of an Algorithm
- Detailed
- Effective
- Specify Behavior
- General Purpose Algorithms
- 3.2.3 Can We Really Do All That?
- 3.3 What Is a Program?
- 3.3.1 Readability
- The Simplest Thing: Good Names
- Comments
- Indenting Code
- 3.3.2 Robust
- 3.3.3 Correctness
- 3.4 Strategies for Program Design
- 3.4.1 Engage and Commit
- 3.4.2 Understand, Then Visualize
- What Is the Actual Problem?
- Making the Problem Real
- 3.4.3 Think Before You Program
- 3.4.4 Experiment
- 3.4.5 Simplify
- The “Onion” Approach
- 3.4.6 Stop and Think
- 3.4.7 Relax: Give Yourself a Break
- 3.5 A Simple Example
- 3.5.1 Build the Skeleton
- 3.5.2 Output
- 3.5.3 Input
- Testing the Input Routine
- 3.5.4 Doing the Calculation
- Summary
- Algorithms
- Rules
- Exercises
- Part 3 Data Structures and Functions
- Chapter 4 Working with Strings
- 4.1 The String Type
- 4.1.1 The Triple-Quote String
- 4.1.2 Nonprinting Characters
- 4.1.3 aString Representation
- 4.1.4 Strings as a Sequence
- 4.1.5 More Indexing and Slicing
- Extended Slicing
- Copy Slice
- 4.1.6 Strings Are Iterable
- Check Yourself: Slicing Check
- 4.2 String Operations
- 4.2.1 Concatenation (+) and Repetition (*)
- 4.2.2 Determining When + Indicates Addition or Concatenation?
- The type Function
- 4.2.3 Comparison Operators
- Single-Character String Compares
- Comparing Strings with More Than One Character
- 4.2.4 The in Operator
- 4.2.5 String Collections Are Immutable
- Check Yourself: String Comparison Check
- 4.3 A Preview of Functions and Methods
- 4.3.1 A String Method
- Chaining of Methods
- Optional Arguments
- Nesting of Methods
- 4.3.2 Determining Method Names and Method Arguments
- 4.3.3 String Methods
- 4.3.4 String Functions
- 4.4 Formatted Output for Strings
- 4.4.1 Descriptor Codes
- 4.4.2 Width and Alignment Descriptors
- 4.4.3 Floating-Point Precision Descriptor
- Check Yourself: More String Manipulation Check
- 4.5 Control and Strings
- 4.6 Working with Strings
- 4.6.1 Example: Reordering a Person’s Name
- 4.6.2 Palindromes
- Changing Case
- Only Letters and Digits
- Putting It All Together
- 4.7 More String Formatting
- 4.8 Unicode
- 4.9 A GUI to Check a Palindrome
- 4.10 What’s Wrong with My Code?
- Summary
- Strings
- Indexing and Slicing
- Formatting
- Iteration: for, enumerate
- Rules
- Exercises
- Programming Projects
- Chapter 5 Functions—QuickStart
- 5.1 What Is a Function?
- 5.1.1 Why Have Functions?
- 5.2 Python Functions
- 5.3 Flow of Control with Functions
- 5.3.1 Function Flow in Detail
- 5.3.2 Parameter Passing
- Check Yourself: Simple Functions Check
- 5.3.3 Another Function Example
- 5.3.4 Function Example: Area of a Triangle
- Input
- Find Side Length
- Calculate Area
- Whole Program
- 5.3.5 Functions Calling Functions
- 5.3.6 When to Use a Function
- 5.3.7 What If There Is No Return Statement?
- 5.3.8 What If There Are Multiple Return Statements?
- 5.4 : Turtle Flag
- 5.5 What’s Wrong with My Code?
- Summary
- Functions
- Rules
- Exercises
- Programming Projects
- Chapter 6 Files and Exceptions I
- 6.1 What Is a File?
- 6.2 Accessing Files: Reading Text Files
- 6.2.1 What’s Really Happening?
- 6.3 Accessing Files: Writing Text Files
- 6.4 Reading and Writing Text Files in a Program
- 6.5 File Creation and Overwriting
- Check Yourself: File Check
- 6.5.1 Files and Functions Example: Word Puzzle
- Reading a File of Words
- Searching a File of Words
- Solving the Puzzle
- Check Yourself: Function Practice with Strings
- 6.6 First Cut, Handling Errors
- 6.6.1 Error Names
- 6.6.2 The try-except Construct
- 6.6.3 try-except Flow of Control
- 6.6.4 Exception Example
- Check Yourself: Exception Check
- 6.7 Example: Counting Poker Hands
- 6.7.1 Program to Count Poker Hands
- Program to Count the Total Hands in the File
- Program to Count the Hands with One Pair
- Program to Calculate the Probability of One Pair
- Error Checking
- The Rest of the Program
- Observations on the Output
- 6.8 GUI to Count Poker Hands
- 6.8.1 Count Hands Function
- 6.8.2 The Rest of the GUI Code
- 6.9 Error Check Float Input
- 6.10 What’s Wrong with My Code?
- Summary
- Files
- Exceptions
- Rules
- Exercises
- Programming Projects
- Chapter 7 Lists and Tuples
- 7.1 What is a List?
- 7.2 What You Already Know How To Do With Lists
- 7.2.1 Indexing and Slicing
- 7.2.2 Operators
- 7.2.3 Functions
- 7.2.4 List Iteration
- 7.3 Lists Are Different than Strings
- 7.3.1 Lists Are Mutable
- 7.3.2 List Methods
- Nonmodifying Methods
- Methods That Modify the List
- More on Sorting
- Check Yourself: Basic Lists Check
- 7.4 Old and New Friends: Split and Other Functions and Methods
- 7.4.1 Split and Multiple Assignment
- 7.4.2 List to String and Back Again, Using join
- 7.4.3 The Sorted Function
- Check Yourself: Lists and Strings Check
- 7.5 Working with Some Examples
- 7.5.1 Anagrams
- Refactoring
- 7.5.2 Example: File Analysis
- Length of Gettysburg Address
- Unique Words in Gettysburg Address
- Better Idea of Unique
- 7.6 Mutable Objects and References
- 7.6.1 Shallow versus Deep Copy
- 7.6.2 Mutable versus Immutable
- Check Yourself: Mutable List Check
- 7.7 Tuples
- 7.7.1 Tuples from Lists
- 7.7.2 Why Tuples?
- 7.8 Lists: The Data Structure
- 7.8.1 Example Data Structure
- 7.8.2 Other Example Data Structures
- 7.9 Algorithm Example: U.S. EPA Automobile Mileage Data
- 7.9.1 csv Module
- 7.10 Plotting EPA Data
- 7.11 List Comprehension
- 7.11.1 Comprehensions, Expressions, and the Ternary Operator
- 7.12 More Plotting
- 7.12.1 Pylab Arrays
- Arrays and range
- Broadcasting
- 7.12.2 Plotting Trigonometric Functions
- 7.13 GUI to Find Anagrams
- 7.13.1 Function Model
- 7.13.2 Controller
- 7.14 What’s Wrong with My Code?
- Summary
- Lists and Tuples
- Indexing and Slicing
- List Methods (Partial List)
- Methods Shared by Lists and Tuples (Partial List)
- Iteration: for, Enumerate
- Rules
- Exercises
- Programming Projects
- Chapter 8 More on Functions
- 8.1 Scope
- 8.1.1 Arguments, Parameters, and Namespaces
- 8.1.2 Passing Mutable Objects
- 8.1.3 Returning a Complex Object
- Check Yourself: Passing Mutables Check
- 8.1.4 Refactoring evens
- 8.2 Default Values and Parameters as Keywords
- 8.2.1 Example: Default Values and Parameter Keywords
- Issues with Default Values
- Check Yourself: More on Functions Check
- 8.3 Functions as Objects
- 8.3.1 Function Annotations
- 8.3.2 Docstrings
- 8.4 Example: Determining a Final Grade
- 8.4.1 The Data
- 8.4.2 The Design
- 8.4.3 Function: weighted_grade
- 8.4.4 Function: parse_line
- 8.4.5 Function: main
- 8.4.6 Example Use
- 8.5 Pass ”’By Value” or ”By Reference”
- 8.6 What’s Wrong with My Code?
- Summary
- Functions
- Rules
- Exercises
- Programming Projects
- Chapter 9 Dictionaries and Sets
- 9.1 Dictionaries
- 9.1.1 Dictionary Example
- 9.1.2 Python Dictionaries
- 9.1.3 Dictionary Indexing and Assignment
- Dictionaries Are Mutable
- Dictionaries with Different Key Types
- 9.1.4 Operators
- Familiar Collection Operations
- Some Dictionary Methods
- Check Yourself: Dictionary Check
- 9.1.5 Ordered Dictionaries
- 9.2 Word Count Example
- 9.2.1 Count Words in a String
- 9.2.2 Word Frequency for Gettysburg Address
- add_word
- process_line
- pretty_print
- main
- 9.2.3 Output and Comments
- 9.3 Periodic Table Example
- 9.3.1 Working with CSV Files
- 9.3.2 Algorithm Overview
- 9.3.3 Functions for Divide and Conquer
- read_table
- parse_element(element_str)
- 9.4 Sets
- 9.4.1 History
- 9.4.2 What’s in a Set?
- 9.4.3 Python Sets
- Python Sets are Mutable
- 9.4.4 Methods, Operators, and Functions for Python Sets
- Typical Operations
- 9.4.5 Set Methods
- Intersection
- Union
- Difference
- Symmetric Difference
- Subset and Superset
- Check Yourself: Set Check
- Other Set methods
- 9.5 Set Applications
- 9.5.1 Relationship between Words of Different Documents
- add_word
- process_line
- main
- pretty_print
- 9.5.2 Output and Comments
- 9.6 Scope: The Full Story
- 9.6.1 Namespaces and Scope
- 9.6.2 Search Rule for Scope
- 9.6.3 Local
- 9.6.4 Global
- The Local Assignment Rule
- The global Statement
- 9.6.5 Built-Ins
- 9.6.6 Enclosed
- 9.7 Using zip to Create Dictionaries
- 9.8 Dictionary and Set Comprehensions
- 9.9 Bar Graph of Word Frequency
- 9.9.1 Getting the Data Right
- 9.9.2 Labels and the xticks Command
- 9.9.3 Plotting
- 9.10 GUI to Compare Files
- 9.10.1 Controller and View
- 9.10.2 Function Model
- 9.11 What’s Wrong with My Code?
- Summary
- Dictionaries
- Sets
- Scope
- Rules
- Exercises
- Programming Projects
- Chapter 10 More Program Development
- 10.1 Introduction
- 10.2 Divide and Conquer
- 10.2.1 Top-Down Refinement
- 10.3 The Breast Cancer Classifier
- 10.3.1 The Problem
- 10.3.2 The Approach: Classification
- 10.3.4 Training and Testing the Classifier
- 10.3.4 Building the Classifier
- 10.4 Designing the Classifier Algorithm
- 10.4.1 Divided, now Conquer
- 10.4.2 Data Structures
- 10.4.3 File Format
- 10.4.4 The make_training_set Function
- 10.4.5 The make_test_set Function
- 10.4.6 The train_classifier Function
- Some Utility Functions for Manipulating Lists
- The sum_lists Function
- The make_averages Function
- 10.4.7 train_classifier, Round 2
- A Little Testing
- 10.4.8 Testing the Classifier on New Data
- Testing the classify_test_set Function
- 10.4.9 The report_results Function
- 10.5 Running the Classifier on Full Data
- 10.5.1 Training versus Testing
- 10.6 Other Interesting Problems
- 10.6.1 Tag Clouds
- 10.6.2 S&P 500 Predictions
- 10.6.3 Predicting Religion with Flags
- 10.7 GUI to Plot the Stock Market
- 10.7.1 Function Model
- 10.7.2 Controller and View
- Summary
- Rules
- Exercises
- Programming Projects
- Part 4 Classes, Making Your Own Data Structures and Algorithms
- Chapter 11 Introduction to Classes
- 11.1 Quickstart: Simple Student Class
- 11.2 Object-Oriented Programming
- 11.2.1 Python Is Object-Oriented!
- 11.2.2 Characteristics of OOP
- 11.3 Working with OOP
- 11.3.1 Class and Instance
- 11.4 Working with Classes and Instances
- 11.4.1 Built-In Class and Instance
- 11.4.2 Our First Class
- A Simple Instance
- 11.4.3 Changing Attributes
- 11.4.4 The Special Relationship Between an Instance and Class: instance-of
- Part of the Python Scope Rules for Objects: Instance, then Class
- 11.5 Object Methods
- 11.5.1 Using Object Methods
- 11.5.2 Writing Methods
- 11.5.3 The Special Argument self
- Check Yourself: Basic Classes Check
- 11.5.4 Methods Are the Interface to a Class Instance
- 11.6 Fitting into the Python Class Model
- 11.6.1 Making Programmer-Defined Classes
- 11.6.2 A Student Class
- 11.6.3 Python Standard Methods
- Initializing the Instance
- Printing the Instance
- Changing an Instance
- Check Yourself: Defining Special Methods
- 11.6.4 Now There Are Three: Class Designer, Programmer, and User
- 11.7 Example: Point Class
- 11.7.1 Construction
- 11.7.2 Distance
- 11.7.3 Summing Two Points
- 11.7.4 Improving the Point Class
- Default Initialization
- “Do the Right Thing”: Printing the Values
- Updated Point Class
- 11.8 Python and OOP
- 11.8.1 Encapsulation
- 11.8.2 Inheritance
- 11.8.3 Polymorphism
- 11.9 Python and Other OOP languages
- 11.9.1 Public versus Private
- 11.9.2 Indicating Privacy Using Double Underscores (__)
- 11.9.3 Python’s Philosophy
- 11.9.4 Modifying an Instance
- 11.10 What’s Wrong with My Code?
- Summary
- Classes
- Rules
- Exercises
- Programming Projects
- Chapter 12 More on Classes
- 12.1 More About Class Properties
- 12.1.1 Rational Number (Fraction) Class Example
- Variation on Import, from
- 12.2 How Does Python Know?
- 12.2.1 Classes, Types, and Introspection
- 12.2.2 Remember Operator Overloading
- 12.3 Creating Your Own Operator Overloading
- 12.3.1 Mapping Operators to Special Methods
- 12.4 Building the Rational Number Class
- 12.4.1 Making the Class
- 12.4.2 Review Fraction Addition
- Euclid and the GCD
- 12.4.3 Back to Adding Fractions
- Assignment
- Check Yourself: Check Defining Your Own Operators
- 12.4.4 Equality and Reducing Rationals
- 12.4.5 Divide and Conquer at Work
- 12.5 What Doesn’t Work (Yet)
- 12.5.1 Introspection
- 12.5.2 Repairing int + Rational Errors
- Mixed-Type Comparisons
- Collection Operators and Iteration
- 12.6 Inheritance
- 12.6.1 The “Find the Attribute” Game
- Class “is-a” Relationship and the Class Hierarchy
- Back to the Game
- 12.6.2 Using Inheritance
- Group Development and OOP
- 12.6.3 Example: The Standard Model
- Using Parent Class Methods
- Changing Code Using Class Inheritance
- 12.7 What’s Wrong with My Code?
- Summary
- Classes
- Rules
- Exercises
- Chapter 13 Program Development with Classes
- 13.1 Predator-Prey Problem
- 13.1.1 The Rules
- 13.1.2 Simulation Using Object-Oriented Programming
- 13.2 Classes
- 13.2.1 Island Class
- 13.2.2 Predator and Prey, Kinds of Animals
- Animal Object
- 13.2.3 Predator and Prey Classes
- 13.2.4 Object Diagram
- 13.2.5 Filling the Island
- Querying a Grid Location
- Repeat Until Full
- 13.3 Adding Behavior
- 13.3.1 Refinement: Add Movement
- Falling off the Island?
- 13.3.2 Refinement: Time Simulation Loop
- 13.4 Refinement: Eating, Breeding, and Keeping Time
- 13.4.1 Improved Time Loop
- Remembering the Breed and Starve Time Spans
- Updating the __init__ Methods
- 13.4.2 Breeding
- The “Neighbor” Method and Updating Move
- Back to Breeding
- 13.4.3 Eating
- 13.4.4 The Tick of the Clock
- 13.5 Refinement: How Many Times to Move?
- 13.6 Graphing Population Size
- Summary
- Exercises
- Part 5 Being a Better Programmer
- Chapter 14 Files and Exceptions II
- 14.1 More Details on Files
- 14.1.1 Other File Access Methods, Reading
- 14.1.2 Other File Access Methods, Writing
- 14.1.3 Universal New Line Format
- 14.1.4 Moving Around in a File
- 14.1.5 Closing a File
- 14.1.6 The with Statement
- 14.1.7 Text File Encodings; Unicode
- Check Yourself: Basic File Operations
- 14.2 CSV Files
- 14.2.1 CSV Module
- 14.2.2 CSV Reader
- 14.2.3 CSV Writer
- 14.2.4 Example: Update Some Grades
- 14.3 Module: os
- 14.3.1 Directory (Folder) Structure
- 14.3.2 os Module Functions
- 14.3.3 os Module Example
- 14.4 More on Exceptions
- 14.4.1 Basic Exception Handling
- 14.4.2 A Simple Example
- Multiple Exceptions in One except
- No Exception except
- 14.4.3 Events
- 14.4.4 A Philosophy Concerning Exceptions
- 14.5 Exception: else and finally
- 14.5.1 finally and with
- 14.5.2 Example: Refactoring the Reprompting of a File Name
- 14.6 More on Exceptions
- 14.6.1 Raise
- Check Yourself: Basic Exception Control
- 14.6.2 Create Your Own
- 14.7 Example: Password Manager
- Summary
- Files
- Exceptions
- Exercises
- Programming Projects
- Chapter 15 Recursion: Another Control Mechanism
- 15.1 What Is Recursion?
- 15.2 Mathematics and Rabbits
- 15.3 Let’s Write Our Own: Reversing a String
- 15.4 How Does Recursion Actually Work?
- 15.4.1 Stack Data Structure
- 15.4.2 Stacks and Function Calls
- 15.4.3 A Better Fibonacci
- 15.5 Recursion in Figures
- 15.5.1 Recursive Tree
- 15.5.2 Sierpinski Triangles
- 15.6 Recursion to Non-recursion
- 15.7 GUI for Turtle Drawing
- 15.7.1 Using Turtle Graphics to Draw
- 15.7.2 Function Model
- 15.7.3 Controller and View
- Summary
- Exercises
- Chapter 16 Other Fun Stuff with Python
- 16.1 Numbers
- 16.1.1 Fractions
- Fraction Construction
- Fraction Operations
- 16.1.2 Decimal
- Decimal Construction
- Decimal Operations
- Other Decimal Properties
- 16.1.3 Complex Numbers
- Python Complex Numbers
- Complex Numbers and cmath
- 16.1.4 Statistics Module
- Averages and Central Location
- Measures of Spread
- 16.1.5 Random Numbers
- 16.2 Even More on Functions
- 16.2.1 Having a Varying Number of Parameters
- Multiple Positional Arguments
- Multiple Keyword Arguments
- 16.2.2 Iterators and Generators
- Iterator Objects
- Collections and Iterator Objects
- How for Works
- Generators
- Why Generators?
- 16.2.3 Other Functional Programming Ideas
- Anonymous Functions, Lambda
- 16.2.4 Some Functional Programming Tools
- 16.2.5 Decorators: Functions Calling Functions
- Passing a Function Object as a Parameter
- Decorators
- Why Is This a “Good Thing”
- 16.3 Classes
- 16.3.1 Properties
- 16.3.2 Serializing an Instance: pickle
- Restrictions
- 16.4 Other Things in Python
- 16.4.1 Data Types
- 16.4.2 Built-in Modules
- 16.4.3 Modules on the Internet
- Chapter 17 The End, or Perhaps the Beginning
- Appendices
- Appendix A Getting and Using Python
- A.1 About Python
- A.1.1 History
- A.1.2 Python 3
- A.1.3 Python Is Free and Portable
- What You Get
- A.1.4 Installing Anaconda
- A.1.5 Starting Our Python IDE: Spyder
- A.1.6 Working with Python
- A.1.7 Making a Program
- A Couple of Early Tips
- Exploring Spyder
- A.2 The iPython Console
- A.2.1 Anatomy of an iPython Session
- A.2.2 Your Top Three iPython Tips
- The Arrow Keys and Your History
- A.2.3 Completion and the Tab Key
- A.2.4 The ? Character
- A.2.5 More iPython Tips
- A.3 Some Conventions for This Book
- A.3.1 Interactive Code
- A.3.2 Program: Written Code
- A.3.3 Combined Program and Output
- A.4 Summary
- Appendix B Simple Drawing with Turtle Graphics
- B.1 Tidbits
- B.1.1 Reset/Close the Turtle Window
- Appendix C What’s Wrong with My Code?
- C.1 It’s Your Fault!
- C.1.1 Kinds of Errors
- Testing for Runtime and Semantic Errors
- C.1.2 “Bugs” and Debugging
- C.2 Debugging
- C.2.1 Testing for Correctness
- C.2.2 Probes
- C.2.3 Debugging with Spyder Example 1
- C.2.4 Debugging Example 1 Using print()
- C.2.5 Debugging with Spyder Example 2
- C.2.6 More Debugging Tips
- C.3 More about Testing
- C.3.1 Testing Is Hard!
- Correctness
- C.3.2 Importance of Testing
- C.3.3 Other Kinds of Testing
- C.4 What’s Wrong with My Code?
- C.4.1 Chapter 1: Beginnings
- C.4.2 Chapter 2: Control
- C.4.3 Chapter 4: Strings
- C.4.4 Chapter 5: Functions
- C.4.5 Chapter 6: Files and Exceptions
- C.4.6 Chapter 7: Lists and Tuples
- C.4.7 Chapter 8: More Functions
- C.4.8 Chapter 9: Dictionaries
- C.4.9 Chapter 11: Classes I
- C.4.10 Chapter 12: Classes II
- Summary
- Appendix D Pylab: A Plotting and Numeric Tool
- D.1 Plotting
- D.2 Working with pylab
- D.2.1 Plot Command
- D.2.2 Colors, Marks, and Lines
- D.2.3 Generating X-Values
- D.2.4 Plot Properties
- D.2.5 Tick Labels
- D.2.6 Legend
- D.2.7 Bar Graphs
- D.2.8 Histograms
- D.2.9 Pie Charts
- D.2.10 How Powerful Is pylab?
- Appendix E Quick Introduction to Web-based User Interfaces
- E.1 Flask
- E.2 QuickStart Flask, Hello World
- E.2.1 What Just Happened?
- E.2.2 Multiple Routes
- E.2.3 Stacked Routes, Passing Address Arguments
- E.3 Serving Up Real HTML Pages
- E.3.1 A Little Bit of HTML
- E.3.2 HTML Tags
- List of HTML Tags
- E.3.3 Flask Returning Web Pages
- E.3.4 Getting Arguments into Our Web Pages
- E.4 Active Web Pages
- E.4.1 Forms in wtforms
- E.4.2 A Good Example Goes a Long Way
- More About the Controller
- More About the View
- More About the Model
- E.4.3 Many Fields Example
- The Model
- The View
- The Controller
- Imports
- InputForm
- Route Function
- E.5 Displaying and Updating Images
- E.6 Odds and Ends
- Appendix F Table of UTF-8 One Byte Encodings
- Appendix G Precedence
- Appendix H Naming Conventions
- H.1 Python Style Elements
- H.2 Naming Conventions
- H.2.1 Our Added Naming Conventions
- H.3 Other Python Conventions
- Appendix I Check Yourself Solutions
- I.1 Chapter 1
- Variables and Assignment
- Types and Operators
- I.2 Chapter 2
- Basic Control Check
- Loop Control Check
- More Control Check
- for and range Check
- I.3 Chapter 4
- Slicing Check
- String Comparison Check
- I.4 Chapter 5
- Simple Functions Check
- I.5 Chapter 6
- Exception Check
- Function Practice with Strings
- I.6 Chapter 7
- Basic Lists Check
- Lists and Strings Check
- Mutable List Check
- I.7 Chapter 8
- Passing Mutables Check
- More on Functions Check
- I.8 Chapter 9
- Dictionary Check
- Set Check
- I.9 Chapter 11
- Basic Classes Check
- Defining Special Methods
- I.10 Chapter 12
- Check Defining Your Own Operators
- I.11 Chapter 14
- Basic File Operations
- Basic Exception Control
- Index
People also search:
practice of computing using python
the practice of computing using python
practice of computing using python 2nd
practice of computing using python 2nd pdf free
practice of computing using python 2nd download scribd