Learn Python 3 the Hard Way: A Very Simple Introduction to the Terrifyingly Beautiful World of Computers and Code, 4th edition

  • James O. Wilkes, 
  • Zed A. Shaw

$16.99per month

Minimum 4-month term, pay monthly or pay $67.96 upfront

Includes:

  • Instant access to eTextbook
  • Search, highlights, notes, and more
  • Expert video lessons and practice questions
  • Videos, study help in multiple subjects. List in FAQs.
  • Practice problems and study guides
  • Q&A with experts and AI tutor
14-day refund guarantee

$10.99per month

Minimum 4-month term, pay monthly or pay $43.96 upfront

Includes:

  • Instant access to eTextbook
  • Search, highlights, notes, and more
14-day refund guarantee

$16.99per month

Minimum 4-month term, pay monthly or pay $67.96 upfront

Includes:

  • Instant access to eTextbook
  • Search, highlights, notes, and more
  • Expert video lessons and practice questions
  • Videos, study help in multiple subjects. List in FAQs.
  • Practice problems and study guides
  • Q&A with experts and AI tutor
14-day refund guarantee

$10.99per month

Minimum 4-month term, pay monthly or pay $43.96 upfront

Includes:

  • Instant access to eTextbook
  • Search, highlights, notes, and more
14-day refund guarantee

$10.99per month

Minimum 4-month term, pay monthly or pay $43.96 upfront

Includes:

  • Instant access to eTextbook
  • Search, highlights, notes, and more
14-day refund guarantee

$10.99per month

Minimum 4-month term, pay monthly or pay $43.96 upfront

Includes:

  • Instant access to eTextbook
  • Search, highlights, notes, and more
14-day refund guarantee

Learn more, spend less

  • Listen on the go

    Learn how you like with full eTextbook audio

  • Find it fast

    Quickly navigate your eTextbook with search

  • Stay organized

    Access all your eTextbooks in one place

  • Easily continue access

    Keep learning with auto-renew

Overview

Preface xvii

Acknowledgments xx

 

Exercise 0: The Setup 2

macOS 2

Windows 3

Linux 4

Finding Things on the Internet 5

Warnings for Beginners 6

Alternative Text Editors 6

 

Exercise 1: A Good First Program 8

What You Should See 10

Study Drills 12

Common Student Questions 12

 

Exercise 2: Comments and Pound Characters 14

What You Should See 14

Study Drills 14

Common Student Questions 15

 

Exercise 3: Numbers and Math 16

What You Should See 17

Study Drills 17

Common Student Questions 17

 

Exercise 4: Variables and Names 20

What You Should See 21

Study Drills 21

Common Student Questions 21

 

Exercise 5: More Variables and Printing 24

What You Should See 24

Study Drills 25

Common Student Questions 25

 

Exercise 6: Strings and Text 26

What You Should See 27

Study Drills 27

Break It 27

Common Student Questions 27

 

Exercise 7: More Printing 28

What You Should See 28

Study Drills 29

Break It 29

Common Student Questions 29

 

Exercise 8: Printing, Printing 30

What You Should See 30

Study Drills 31

Common Student Questions 31

 

Exercise 9: Printing, Printing, Printing 32

What You Should See 32

Study Drills 33

Common Student Questions 33

 

Exercise 10: What Was That? 34

What You Should See 35

Escape Sequences 35

Study Drills 36

Common Student Questions 36

 

Exercise 11: Asking Questions 38

What You Should See 38

Study Drills 39

Common Student Questions 39

 

Exercise 12: Prompting People 40

What You Should See 40

Study Drills 40

Common Student Questions 41

 

Exercise 13: Parameters, Unpacking, Variables 42

Hold Up! Features Have Another Name 42

What You Should See 43

Study Drills 44

Common Student Questions 44

 

Exercise 14: Prompting and Passing 46

What You Should See 46

Study Drills 47

Common Student Questions 47

 

Exercise 15: Reading Files 48

What You Should See 49

Study Drills 49

Common Student Questions 50

 

Exercise 16: Reading and Writing Files 52

What You Should See 53

Study Drills 53

Common Student Questions 54

 

Exercise 17: More Files 56

What You Should See 56

Study Drills 57

Common Student Questions 57

 

Exercise 18: Names, Variables, Code, Functions 60

What You Should See 61

Study Drills 62

Common Student Questions 62

 

Exercise 19: Functions and Variables 64

What You Should See 65

Study Drills 65

Common Student Questions 65

 

Exercise 20: Functions and Files 68

What You Should See 69

Study Drills 69

Common Student Questions 69

 

Exercise 21: Functions Can Return Something 72

What You Should See 73

Study Drills 73

Common Student Questions 74

 

Exercise 22: What Do You Know So Far? 76

What You Are Learning 76

 

Exercise 23: Strings, Bytes, and Character Encodings 78

Initial Research 78

Switches, Conventions, and Encodings 80

Disecting the Output 82

Disecting the Code 82

Encodings Deep Dive 84

Breaking It 85

 

Exercise 24: More Practice 86

What You Should See 87

Study Drills 87

Common Student Questions 87

 

Exercise 25: Even More Practice 90

What You Should See 91

Study Drills 92

Common Student Questions 93

 

Exercise 26: Congratulations, Take a Test! 94

Common Student Questions 94

 

Exercise 27: Memorizing Logic 96

The Truth Terms 96

The Truth Tables 97

Common Student Questions 98

 

Exercise 28: Boolean Practice 100

What You Should See 102

Study Drills 102

Common Student Questions 102

 

Exercise 29: What If 104

What You Should See 104

Study Drills 105

Common Student Questions 105

 

Exercise 30: Else and If 106

What You Should See 107

Study Drills 107

Common Student Questions 107

 

Exercise 31: Making Decisions 108

What You Should See 109

Study Drills 109

Common Student Questions 109

 

Exercise 32: Loops and Lists 112

What You Should See 113

Study Drills 114

Common Student Questions 114

 

Exercise 33: While Loops 116

What You Should See 117

Study Drills 117

Common Student Questions 118

 

Exercise 34: Accessing Elements of Lists 120

Study Drills 121

 

Exercise 35: Branches and Functions 122

What You Should See 123

Study Drills 124

Common Student Questions 124

 

Exercise 36: Designing and Debugging 126

Rules for if-statements 126

Rules for Loops 126

Tips for Debugging 127

Homework 127

 

Exercise 37: Symbol Review 128

Keywords 128

Data Types 129

String Escape Sequences 130

Old Style String Formats 130

Operators 131

Reading Code 132

Study Drills 133

Common Student Questions 133

 

Exercise 38: Doing Things to Lists 134

What You Should See 135

What Lists Can Do 136

When to Use Lists 137

Study Drills 137

Common Student Questions 138

 

Exercise 39: Dictionaries, Oh Lovely Dictionaries 140

A Dictionary Example 141

What You Should See 142

What Dictionaries Can Do 143

Study Drills 144

Common Student Questions 144

 

Exercise 40: Modules, Classes, and Objects 146

Modules Are Like Dictionaries 146

What You Should See 150

Study Drills 150

Common Student Questions 151

 

Exercise 41: Learning to Speak Object-Oriented 152

Word Drills 152

Phrase Drills 152

Combined Drills 153

A Reading Test 153

Practice English to Code 155

Reading More Code 156

Common Student Questions 156

 

Exercise 42: Is-A, Has-A, Objects, and Classes 158

How This Looks in Code 159

About class Name(object) 161

Study Drills 161

Common Student Questions 161

 

Exercise 43: Basic Object-Oriented Analysis and Design 164

The Analysis of a Simple Game Engine 165

Top Down versus Bottom Up 169

The Code for “Gothons from Planet Percal #25” 170

What You Should See 176

Study Drills 176

Common Student Questions 177

 

Exercise 44: Inheritance versus Composition 178

What Is Inheritance? 178

The Reason for super() 183

Composition 184

When to Use Inheritance or Composition 185

Study Drills 185

Common Student Questions 186

 

Exercise 45: You Make a Game 188

Evaluating Your Game 188

Function Style 189

Class Style 189

Code Style 190

Good Comments 190

Evaluate Your Game 190

 

Exercise 46: A Project Skeleton 192

macOS/Linux Setup 192

Windows 10 Setup 194

Creating the Skeleton Project Directory 195

Testing Your Setup 197

Using the Skeleton 198

Required Quiz 198

Common Student Questions 198

 

Exercise 47: Automated Testing 200

Writing a Test Case 200

Testing Guidelines 202

What You Should See 202

Study Drills 203

Common Student Questions 203

 

Exercise 48: Advanced User Input 204

Our Game Lexicon 204

A Test First Challenge 206

What You Should Test 207

Study Drills 209

Common Student Questions 209

 

Exercise 49: Making Sentences 210

Match and Peek 210

The Sentence Grammar 211

A Word on Exceptions 211

The Parser Code 211

Playing with the Parser 214

What You Should Test 215

Study Drills 215

Common Student Questions 215

 

Exercise 50: Your First Website 216

Installing flask 216

Make a Simple “Hello World” Project 216

What’s Going On? 218

Fixing Errors 218

Create Basic Templates 219

Study Drills 221

Common Student Questions 221

 

Exercise 51: Getting Input from a Browser 224

How the Web Works 224

How Forms Work 226

Creating HTML Forms 227

Creating a Layout Template 229

Writing Automated Tests for Forms 230

Study Drills 232

Breaking It 232

 

Exercise 52: The Start of Your Web Game 234

Refactoring the Exercise 43 Game 234

Creating an Engine 239

Your Final Exam 241

Common Student Questions 242

 

Next Steps 244

How to Learn Any Programming Language 245

 

Advice from an Old Programmer 246

 

Appendix Command Line Crash Course 248

Introduction: Shut Up and Shell 248

The Setup 249

Paths, Folders, Directories (pwd) 253

If You Get Lost 255

Make a Directory (mkdir) 255

Change Directory (cd) 258

List Directory (ls) 261

Remove Directory (rmdir) 265

Moving Around (pushd, popd) 268

Making Empty Files (touch/New-Item) 271

Copy a File (cp) 272

Moving a File (mv) 275

View a File (less/more) 277

Stream a File (cat) 278

Removing a File (rm) 280

Exiting Your Terminal (exit) 282

Command Line Next Steps 283

 

Index 284

Published by Addison-Wesley Professional (June 22nd 2021) - Copyright © 2018

ISBN-13: 9780137460601

Subject: Programming - Introductory

Category: Python

Your questions answered

Pearson+ is your 1-stop shop with eTextbooks, study tools and exam prep features designed to help students get better grades in college. eTextbooks come with built-in tools that simplify studying, like flashcards, audiobook and search. Pearson+ also features Channels, which includes practice problems, study guides, Q&A with experts, video lessons that help you understand tricky topics and more—all in one place. Channels can be purchased separately or added on to your eTextbook at the time of purchase as part of the Study & Exam Prep Pack.

A Pearson eTextbook is an easy-to-use digital version of your book for class that includes upgraded study tools to help you learn how you learn best. Use enhanced search to find what you need within your eTextbook, highlight and make notes to mark important info, generate flashcards to test your knowledge, and use audio to listen to the text. Every feature is designed to help you learn more efficiently and get results. Plus, you can learn on the go with the Pearson+ app. Find this and more in your eTextbook, available in Pearson+.

The Study & Exam Prep Pack includes practice problems, study guides, Q&A with experts, Channels video lessons that help you understand tricky topics and more. It can be added on to your eTextbook or your MyLab and Mastering learning platform at the time of purchase.

Your eTextbook subscription gives you access for 4 months. You can make a one‑time payment for the initial 4‑month term or pay monthly. If you opt for monthly payments, we will charge your payment method each month until your 4‑month term ends. You can turn on auto‑renew in My account at any time to continue your subscription before your 4‑month term ends.

When you purchase an eTextbook subscription, it will last 4 months. You can renew your subscription by selecting Extend subscription on the Manage subscription page in My account before your initial term ends.

If you extend your subscription, we'll automatically charge you every month. If you made a one‑time payment for your initial 4‑month term, you'll now pay monthly. To make sure your learning is uninterrupted, please check your card details.

To avoid the next payment charge, select Cancel subscription on the Manage subscription page in My account before the renewal date. You can subscribe again in the future by purchasing another eTextbook subscription.

Channels is a video platform with thousands of explanations, solutions and practice problems to help you do homework and prep for exams. Videos are personalized to your course, and tutors walk you through solutions. Plus, interactive AI‑powered summaries and a social community help you better understand lessons from class.

Channels is an additional tool to help you with your studies. This means you can use Channels even if your course uses a non‑Pearson textbook.

When you choose a Channels subscription, you're signing up for a 1‑month, 3‑month or 12‑month term and you make an upfront payment for your subscription. By default, these subscriptions auto‑renew at the frequency you select during checkout.

When you purchase a Channels subscription it will last 1 month, 3 months or 12 months, depending on the plan you chose. Your subscription will automatically renew at the end of your term unless you cancel it.

We use your credit card to renew your subscription automatically. To make sure your learning is uninterrupted, please check your card details.

A Study & Exam Prep subscription includes video lessons, practice problems and other study tools. Get unlimited access to the full range of subjects:

  • General Chemistry
  • Physics
  • General Biology
  • Financial Accounting
  • Psychology
  • Microeconomics
  • Anatomy & Physiology
  • College Algebra
  • Organic Chemistry
  • Genetics
  • GOB Chemistry
  • Intro to Chemistry
  • Microbiology
  • Cell Biolog
  • Analytical Chemistry
  • Trigonometry
  • Precalculus
  • Biochemistry
  • Macroeconomics
  • Yes, the Study & Exam Prep Pack's feature is Channels, which can be purchased separately at any time. Simply go to Channels on the Pearson+ site and choose monthly, quarterly, or annual access, separate from your eTextbook subscription. Still deciding? Watch the first six videos free and buy it if you love it (we know you'll love it!).

    Currently, they are the exact same offering. 'Study & Exam Prep Pack' is what we call 'Channels' when it is bundled with an eTextbook or bundled with MyLab & Mastering courseware. When purchased on its own, you will see it called Channels, still the same study & exam prep help you need.