Starting Out With Python Second Edition

Tony Gaddis

1. Python (Computer program language)


e-books shop
e-books shop
Purchase Now !
Just with Paypal



Book Details
 Price
 2.50
 Pages
 632 p
 File Size 
 3,794 KB
 File Type
 PDF format
 ISBN-13
 ISBN-10
 978-0-13-257637-6
 0-13-257637-6
 Copyright©   
 2012, 2009 Pearson Education, Inc 

Preface
Welcome to Starting Out with Python, Second Edition. This book uses the Python language
to teach programming concepts and problem-solving skills, without assuming any previous
programming experience. With easy-to-understand examples, pseudocode, flowcharts, and
other tools, the student learns how to design the logic of programs and then implement
those programs using Python. This book is ideal for an introductory programming course
or a programming logic and design course using Python as the language.

As with all the books in the Starting Out With series, the hallmark of this text is its clear,
friendly, and easy-to-understand writing. In addition, it is rich in example programs that
are concise and practical. The programs in this book include short examples that highlight
specific programming topics, as well as more involved examples that focus on problem
solving. Each chapter provides one or more case studies that provide step-by-step analysis
of a specific problem and shows the student how to solve it.

Control Structures First, Then Classes
Python is a fully object-oriented programming language, but students do not have to understand
object-oriented concepts to start programming in Python. This text first introduces the student
to the fundamentals of data storage, input and output, control structures, functions, sequences
and lists, file I/O, and objects that are created from standard library classes. Then the student
learns to write classes, explores the topics of inheritance and polymorphism, and learns to write
recursive functions. Finally, the student learns to develop simple event-driven GUI applications.

Table of Contents
Preface xi
Chapter 1 Introduction to Computers and Programming 1
1.1 Introduction 1
1.2 Hardware and Software 2
1.3 How Computers Store Data 8
1.4 How a Program Works 13
1.5 Using Python 20
Chapter 2 Input, Processing, and Output 31
2.1 Designing a Program 31
2.2 Input, Processing, and Output 35
2.3 Displaying Output with the print Function 36
2.4 Comments 39
2.5 Variables 40
2.6 Reading Input from the Keyboard 49
2.7 Performing Calculations 53
2.8 More About Data Output 65
Chapter 3 Simple Functions 81
3.1 Introduction to Functions 81
3.2 Defining and Calling a Function 83
3.3 Designing a Program to Use Functions 89
3.4 Local Variables 95
3.5 Passing Arguments to Functions 97
3.6 Global Variables and Global Constants 107
Chapter 4 Decision Structures and Boolean Logic 117
4.1 The if Statement 117
4.2 The if-else Statement 125
4.3 Comparing Strings 130
4.4 Nested Decision Structures and the if-elif-else Statement 134
4.5 Logical Operators 142
4.6 Boolean Variables 149
Chapter 5 Repetition Structures 157
5.1 Introduction to Repetition Structures 157
5.2 The while Loop: a Condition-Controlled Loop 158
5.3 The for Loop: a Count-Controlled Loop 167
5.4 Calculating a Running Total 179
5.5 Sentinels 182
5.6 Input Validation Loops 185
5.7 Nested Loops 190
Chapter 6 Value-Returning Functions and Modules 203
6.1 Introduction to Value-Returning Functions:
Generating Random Numbers 203
6.2 Writing Your Own Value-Returning Functions 214
6.3 The math Module 225
6.4 Storing Functions in Modules 228
Chapter 7 Files and Exceptions 239
7.1 Introduction to File Input and Output 239
7.2 Using Loops to Process Files 256
7.3 Processing Records 263
7.4 Exceptions 276
Chapter 8 Lists and Tuples 295
8.1 Sequences 295
8.2 Introduction to Lists 295
8.3 List Slicing 303
8.4 Finding Items in Lists with the in Operator 306
8.5 List Methods and Useful Built-in Functions 307
8.6 Copying Lists 314
8.7 Processing Lists 316
8.8 Two-Dimensional Lists 328
8.9 Tuples 332
Chapter 9 More About Strings 341
9.1 Basic String Operations 341
9.2 String Slicing 349
9.3 Testing, Searching, and Manipulating Strings 353
Chapter 10 Dictionaries and Sets 371
10.1 Dictionaries 371
10.2 Sets 394
10.3 Serializing Objects 406
Chapter 11 Classes and Object-Oriented Programming 421
11.1 Procedural and Object-Oriented Programming 421
11.2 Classes 425
11.3 Working with Instances 442
11.4 Techniques for Designing Classes 464
Chapter 12 Inheritance 483
12.1 Introduction to Inheritance 483
12.2 Polymorphism 498
Chapter 13 Recursion 509
13.1 Introduction to Recursion 509
13.2 Problem Solving with Recursion 512
13.3 Examples of Recursive Algorithms 516
Chapter 14 GUI Programming 529
14.1 Graphical User Interfaces 529
14.2 Using the tkinter Module 531
14.3 Display Text with Label Widgets 534
14.4 Organizing Widgets with Frames 537
14.5 Button Widgets and Info Dialog Boxes 540
14.6 Getting Input with the Entry Widget 543
14.7 Using Labels as Output Fields 546
14.8 Radio Buttons and Check Buttons 554
Appendix A Installing Python 567
Appendix B Introduction to IDLE 569
Appendix C The ASCII Character Set 577
Appendix D Answers to Checkpoints 579
Index 595


Bookscreen
e-books shop

About the Author
Tony Gaddis is the principal author of the Starting Out With series of textbooks. Tony has
nearly two decades of experience teaching computer science courses, primarily at Haywood
Community College. He is a highly acclaimed instructor who was previously selected as the
North Carolina Community College “Teacher of the Year” and has received the Teaching
Excellence award from the National Institute for Staff and Organizational Development.
The Starting Out With series includes introductory books covering C++, Java™, Microsoft®
Visual Basic®, Microsoft® C#®, Python®, Programming Logic and Design, and Alice, all
published by Addison-Wesley. More information about all these books can be found at
www.pearsonhighered.com/gaddisbooks.
Previous Post Next Post