Practical Programming: An Introduction to Computer Science Using Python

Paperback (Print)
Buy Used
Buy Used from
(Save 25%)
Item is in good condition but packaging may have signs of shelf wear/aging or torn packaging.
Condition: Used – Good details
Used and New from Other Sellers
Used and New from Other Sellers
from $9.27
Usually ships in 1-2 business days
(Save 71%)
Other sellers (Paperback)
  • All (8) from $9.27   
  • New (1) from $70.00   
  • Used (7) from $9.27   
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any coupons and promotions
Seller since 2014

Feedback rating:



New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Sort by


Welcome to computer science in the 21st century. Did you ever wonder how computers represent DNA? How they can download a web page containing population data and analyze it to spot trends? Or how they can change the colors in a color photograph? If so, this book is for you. By the time you're done, you'll know how to do all of that and a lot more. And Python makes it easy and fun.

Computers are used in every part of science from ecology to particle physics. This introduction to computer science continually reinforces those ties by using real-world science problems as examples. Anyone who has taken a high school science class will be able to follow along as the book introduces the basics of programming, then goes on to show readers how to work with databases, download data from the web automatically, build graphical interfaces, and most importantly, how to think like a professional programmer.

Topics covered include:

Basic elements of programming from arithmetic to loops and if statements.

Using functions and modules to organize programs.

Using lists, sets, and dictionaries to organize data.

Designing algorithms systematically.

Debugging things when they go wrong.

Creating and querying databases.

Building graphical interfaces to make programs easier to use.

Object-oriented programming and programming patterns.

Read More Show Less

Product Details

  • ISBN-13: 9781934356272
  • Publisher: Pragmatic Programmers, LLC, The
  • Publication date: 5/28/2009
  • Series: Pragmatic Programmers Series
  • Pages: 350
  • Product dimensions: 7.40 (w) x 8.90 (h) x 0.80 (d)

Meet the Author

Jennifer Campbell is a senior lecturer in the Department of Computer Science at the University of Toronto. Over the past 10 years, Jen's primary focus has been on teaching and curriculum design of introductory courses. Jen is involved in several projects exploring student experiences in introductory computer science courses and the factors that contribute to success, including the effectiveness of the inverted classroom.

Paul Gries has been teaching in the Department of Computer Science at the University of Toronto for more than 15 years. During his time at UofT, Paul has won numerous teaching awards, including UofT's most prestigious teaching award and an Ontario-wide teaching award. Paul has also co-authored two textbooks, has been a leader in departmental curriculum design and renewal, and, with Jen, got to teach Python to tens of thousands of students in a MOOC.

Jason Montojo is a research officer at the Donnelly Centre for Cellular and Biomolecular Research at the University of Toronto, where he develops scientific software for the Cytoscape and GeneMANIA projects. He has a strong interest in teaching computer science and frequently mentors students for Google's Summer of Code program.

Greg Wilson holds a Ph.D. in Computer Science from the University of Edinburgh, and has worked on high-performance scientific computing, data visualization, and computer security. He is the author of Data Crunching and Practical Parallel Programming (MIT Press, 1995), and is a contributing editor at Doctor Dobb's Journal, and an adjunct professor in Computer Science at the University of Toronto.

Read More Show Less

Table of Contents

1 Introduction 1

1.1 Programs and Programming 3

1.2 A Few Definitions 4

1.3 What to Install 4

1.4 For Instructors 5

1.5 Summary 6

2 Hello, Python 7

2.1 The Big Picture 7

2.2 Expressions 9

2.3 What Is a Type? 12

2.4 Variables and the Assignment Statement 15

2.5 When Things Go Wrong 19

2.6 Function Basics 20

2.7 Built-in Functions 23

2.8 Style Notes 24

2.9 Summary 25

2.10 Exercises 26

3 Strings 29

3.1 Strings 29

3.2 Escape Characters 32

3.3 Multiline Strings 33

3.4 Print 34

3.5 Formatted Printing 35

3.6 User Input 36

3.7 Summary 37

3.8 Exercises 38

4 Modules 41

4.1 Importing Modules 41

4.2 Defining Your Own Modules 45

4.3 Objects and Methods 51

4.4 Pixels and Colors 59

4.5 Testing 61

4.6 Style Notes 67

4.7 Summary 68

4.8 Exercises 69

5 Lists 73

5.1 Lists and Indices 73

5.2 Modifying Lists 77

5.3 Built-in Functions on Lists 79

5.4 Processing List Items 81

5.5 Slicing 84

5.6 Aliasing 86

5.7 List Methods 87

5.8 Nested Lists 89

5.9 Other Kinds of Sequences 91

5.10 Files as Lists 92

5.11 Comments 95

5.12 Summary 97

5.13 Exercises 97

6 Making Choices 101

6.1 Boolean Logic 101

6.2 if Statements 111

6.3 Storing Conditionals 118

6.4 Summary 119

6.5 Exercises 120

7 Repetition 125

7.1 Counted Loops 125

7.2 while Loops 134

7.3 User Input Loops 142

7.4 Controlling Loops 143

7.5 Style Notes 147

7.6 Summary 148

7.7 Exercises 149

8 File Processing 153

8.1 One Record per Line 154

8.2 Records with Multiple Fields 164

8.3 Positional Data 167

8.4 Multiline Records 170

8.5 Looking Ahead 172

8.6 Writing to Files 174

8.7 Summary 176

8.8 Exercises 176

9 Sets andDictionaries 179

9.1 Sets 179

9.2 Dictionaries 184

9.3 Inverting a Dictionary 191

9.4 Summary 192

9.5 Exercises 193

10 Algorithms 197

10.1 Searching 198

10.2 Timing 205

10.3 Summary 205

10.4 Exercises 206

11 Searching and Sorting 209

11.1 Linear Search 209

11.2 Binary Search 213

11.3 Sorting 217

11.4 More Efficient Sorting Algorithms 223

11.5 Mergesort: An Nlog2N Algorithm 224

11.6 Summary 228

11.7 Exercises 229

12 Construction 233

12.1 More on Functions 233

12.2 Exceptions 238

12.3 Testing 245

12.4 Debugging 250

12.5 Patterns 252

12.6 Summary 256

12.7 Exercises 257

13 Object-Oriented Programming 267

13.1 Class Color 268

13.2 Special Methods 273

13.3 More About dir and help 275

13.4 A Little Bit of OO Theory 277

13.5 A Longer Example 285

13.6 Summary 290

13.7 Exercises 290

14 Graphical User Interfaces 291

14.1 The Tkinter Module 292

14.2 Basic GUI Construction 293

14.3 Models, Views, and Controllers 298

14.4 Style 304

14.5 A Few More Widgets 309

14.6 Object-Oriented GUIs 313

14.7 Summary 314

14.8 Exercises 315

15 Databases 319

15.1 The Big Picture 319

15.2 First Steps 321

15.3 Retrieving Data 325

15.4 Updating and Deleting 328

15.5 Transactions 329

15.6 Using NULL for Missing Data 331

15.7 Using Joins to Combine Tables 332

15.8 Keys and Constraints 337

15.9 Advanced Features 339

15.10 Summary 344

15.11 Exercises 345

A Bibliography 349

Index 351

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)