Practical Programming: An Introduction to Computer Science Using Python / Edition 1

Practical Programming: An Introduction to Computer Science Using Python / Edition 1

by Jennifer Campbell, Paul Gries, Jason Montojo, Greg Wilson
     
 

Computers are used in every part of science from ecology to particle physics. This introduction to computer science using Python continually reinforces those ties by using real-world science problems as examples.See more details below

Overview

Computers are used in every part of science from ecology to particle physics. This introduction to computer science using Python continually reinforces those ties by using real-world science problems as examples.

Product Details

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

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

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >