Pythonforprogrammers Toc
Pythonforprogrammers Toc
Contents
Preface xvii
Before You Begin xxxiii
1 Introduction to Computers and Python 1
1.1 Introduction 2
1.2 A Quick Review of Object Technology Basics 3
1.3 Python 5
1.4 It’s the Libraries! 7
1.4.1 Python Standard Library 7
1.4.2 Data-Science Libraries 8
1.5 Test-Drives: Using IPython and Jupyter Notebooks 9
1.5.1 Using IPython Interactive Mode as a Calculator 9
1.5.2 Executing a Python Program Using the IPython Interpreter 10
1.5.3 Writing and Executing Code in a Jupyter Notebook 12
1.6 The Cloud and the Internet of Things 16
1.6.1 The Cloud 16
1.6.2 Internet of Things 17
1.7 How Big Is Big Data? 17
1.7.1 Big Data Analytics 22
1.7.2 Data Science and Big Data Are Making a Difference: Use Cases 23
1.8 Case Study—A Big-Data Mobile Application 24
1.9 Intro to Data Science: Artificial Intelligence—at the Intersection of CS
and Data Science 26
1.10 Wrap-Up 29
viii Contents
3 Control Statements 49
3.1 Introduction 50
3.2 Control Statements 50
3.3 if Statement 51
3.4 if…else and if…elif…else Statements 52
3.5 while Statement 55
3.6 for Statement 55
3.6.1 Iterables, Lists and Iterators 56
3.6.2 Built-In range Function 57
3.7 Augmented Assignments 57
3.8 Sequence-Controlled Iteration; Formatted Strings 58
3.9 Sentinel-Controlled Iteration 59
3.10 Built-In Function range: A Deeper Look 60
3.11 Using Type Decimal for Monetary Amounts 61
3.12 break and continue Statements 64
3.13 Boolean Operators and, or and not 65
3.14 Intro to Data Science: Measures of Central Tendency—
Mean, Median and Mode 67
3.15 Wrap-Up 69
4 Functions 71
4.1 Introduction 72
4.2 Defining Functions 72
4.3 Functions with Multiple Parameters 75
4.4 Random-Number Generation 76
4.5 Case Study: A Game of Chance 78
4.6 Python Standard Library 81
4.7 math Module Functions 82
4.8 Using IPython Tab Completion for Discovery 83
4.9 Default Parameter Values 85
4.10 Keyword Arguments 85
4.11 Arbitrary Argument Lists 86
4.12 Methods: Functions That Belong to Objects 87
4.13 Scope Rules 87
4.14 import: A Deeper Look 89
4.15 Passing Arguments to Functions: A Deeper Look 90
4.16 Recursion 93
4.17 Functional-Style Programming 95
4.18 Intro to Data Science: Measures of Dispersion 97
4.19 Wrap-Up 98
Contents ix
x Contents
Contents xi
xii Contents
Contents xiii
xiv Contents
Contents xv
xvi Contents
Index 573