Fundamentals of Python Programming

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Richard L. Halterman
Publisher: Southern Adventist University
Year: 2015

Language: English

The Context of Software Development
Software
Development Tools
Learning Programming with Python
Writing a Python Program
The Python Interactive Shell
A Longer Python program
Summary
Exercises
Values and Variables
Integer and String Values
Variables and Assignment
Identifiers
Floating-point Numbers
Control Codes within Strings
User Input
The eval Function
Controlling the print Function
String Formatting
Summary
Exercises
Expressions and Arithmetic
Expressions
Mixed Type Expressions
Operator Precedence and Associativity
Comments
Errors
Syntax Errors
Run-time Exceptions
Logic Errors
Arithmetic Examples
More Arithmetic Operators
Algorithms
Summary
Exercises
Conditional Execution
Boolean Expressions
Boolean Expressions
The Simple if Statement
The if/else Statement
Compound Boolean Expressions
The pass Statement
Floating-point Equality
Nested Conditionals
Multi-way Decision Statements
Conditional Expressions
Errors in Conditional Statements
Summary
Exercises
Iteration
The while Statement
Definite Loops vs. Indefinite Loops
The for Statement
Nested Loops
Abnormal Loop Termination
The break statement
The continue Statement
while/else and for/else
Infinite Loops
Iteration Examples
Computing Square Root
Drawing a Tree
Printing Prime Numbers
Insisting on the Proper Input
Summary
Exercises
Using Functions
Introduction to Using Functions
Standard Mathematical Functions
time Functions
Random Numbers
Importing Issues
Summary
Exercises
Writing Functions
Function Basics
Main Function
Parameter Passing
Function Examples
Better Organized Prime Generator
Command Interpreter
Restricted Input
Better Die Rolling Simulator
Tree Drawing Function
Floating-point Equality
Custom Functions vs. Standard Functions
Summary
Exercises
More on Functions
Global Variables
Default Parameters
Introduction to Recursion
Making Functions Reusable
Documenting Functions and Modules
Functions as Data
Lambda Expressions
Generators
Local Function Definitions
Summary
Exercises
Objects
Using Objects
String Objects
File Objects
Fraction Objects
Turtle Graphics
Graphics with tkinter Objects
Other Standard Python Objects
Object Mutability and Aliasing
Garbage Collection
Summary
Exercises
Lists
Using Lists
List Traversal
Building Lists
List Membership
List Assignment and Equivalence
List Bounds
Slicing
List Element Removal
Lists and Functions
List Methods
Prime Generation with a List
Command-line Arguments
List Comprehensions
Summary of List Creation Techniques
Lists vs. Generators
Summary
Exercises
Sorting and Searching
Sorting
Flexible Sorting
Faster Sorting
Search
Linear Search
Binary Search
Recursion Revisited
List Permutations
Randomly Permuting a List
Reversing a List
Summary
Exercises
Tuples, Dictionaries, and Sets
Tuples
Arbitrary Argument Lists
Dictionaries
Using Dictionaries
Counting with Dictionaries
Grouping with Dictionaries
Implementing Mathematical Graphs
Keyword Arguments
Sets
Set Quantification with all and any
Summary
Exercises
Handling Exceptions
Motivation
Common Standard Exceptions
Handling Exceptions
Handling Multiple Exceptions
The Catch-all Handler
Catching Exception Objects
The try Statement's Optional else Block
finally block
Exception Handling Scope
Raising Exceptions
Using Exceptions
Summary
Exercises
Custom Types
Circle Objects
Restricting Access to Members
Bank Account Objects
Stopwatch Objects
Automated Testing
Class Inheritance
Custom Exceptions
Summary
Exercises
Index