Python for Everyone, 3rd Edition is an introduction to programming designed to serve a wide range of student interests and abilities, focused on the essentials, and on effective learning. It is suitable for a first course in programming for computer scientists, engineers, and students in other disciplines. This text requires no prior programming experience and only a modest amount of high school algebra. Objects are used where appropriate in early chapters and students start designing and implementing their own classes in Chapter 9. New to this edition are examples and exercises that focus on various aspects of data science.
Preface iii
Special Features xviii
1 Introduction 1
1.1 Computer Programs 2
1.2 The Anatomy of a Computer 3
CS 1 Computers Are Everywhere 5
1.3 The Python Programming Language 5
1.4 Becoming Familiar with Your Programming Environment 6
PT 1 Interactive Mode 8
PT 2 Backup Copies 9
ST 1 The Python Interpreter 10
1.5 Analyzing Your First Program 11
1.6 Errors 13
CE 1 Misspelling Words 14
1.7 PROBLEM SOLVING: Algorithm Design 15
CS 2 Data Is Everywhere 17
HT 1 Describing an Algorithm with Pseudocode 18
WE 1 Writing an Algorithm for Tiling a Floor 20
2 Programming With Numbers and Strings 23
2.1 Variables 24
Defining Variables 24
Number Types 26
Variable Names 27
Constants 28
Comments 29
CE 1 Using Undefined Variables 30
PT 1 Choose Descriptive Variable Names 30<lcÈ