close menu
Bookswagon-24x7 online bookstore
close menu
My Account
Learn Python the Hard Way

Learn Python the Hard Way

          
5
4
3
2
1

Out of Stock


Premium quality
Premium quality
Bookswagon upholds the quality by delivering untarnished books. Quality, services and satisfaction are everything for us!
Easy Return
Easy return
Not satisfied with this product! Keep it in original condition and packaging to avail easy return policy.
Certified product
Certified product
First impression is the last impression! Address the book’s certification page, ISBN, publisher’s name, copyright page and print quality.
Secure Checkout
Secure checkout
Security at its finest! Login, browse, purchase and pay, every step is safe and secured.
Money back guarantee
Money-back guarantee:
It’s all about customers! For any kind of bad experience with the product, get your actual amount back after returning the product.
On time delivery
On-time delivery
At your doorstep on time! Get this book delivered without any delay.
Notify me when this book is in stock
Add to Wishlist

About the Book

You Will Learn Python!

Zed Shaw has created the world's most reliable system for learning Python. Follow it and you will succeed--just like the millions of beginners Zed has taught to date! You bring the discipline, persistence, and attention; the author supplies the masterful knowledge you need to succeed.

In Learn Python the Hard Way, Fifth Edition, you'll learn Python by working through 60 lovingly crafted exercises. Read them. Type in the code. Run it. Fix your mistakes. Repeat. As you do, you'll learn how a computer works, how to solve problems, and how to enjoy programming . . . even when it's driving you crazy.

  • Install a complete Python environment
  • Organize and write code
  • Fix and break code
  • Basic mathematics
  • Strings and text
  • Interact with users
  • Work with files
  • Looping and logic
  • Object-oriented programming
  • Data structures using lists and dictionaries
  • Modules, classes, and objects
  • Python packaging
  • Automated testing
  • Basic SQL for Data Science
  • Web scraping
  • Fixing bad data (munging)
  • The "Data" part of "Data Science"

It'll be frustrating at first. But if you keep trying, you'll get it--and it'll feel amazing! This course will reward you for every minute you put into it. Soon, you'll know one of the world's most powerful, popular programming languages. You'll be a Python programmer.

This Book Is Perfect For

  • Total beginners with zero programming experience
  • Junior developers who know one or two languages
  • Returning professionals who haven't written code in years
  • Aspiring Data Scientists or academics who need to learn to code
  • Seasoned professionals looking for a fast, simple crash course in Python for Data Science

Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.



Table of Contents:

Preface xix

Module 1: Getting Started in Python 1

Exercise 0: Gearing Up 2
General Instructions 2
Minimalist Start 3
Complete Instructions 3
Testing Your Setup 3
Learning the Command Line 4
Next Steps 5

Exercise 1: A Good First Program 6
What You Should See 7
Study Drills 8
Common Student Questions 9
The Blue Plus 9

Exercise 2: Comments and Pound Characters 10
What You Should See 10
Study Drills 10
Common Student Questions 11

Exercise 3: Numbers and Math 12
What You Should See 13
Study Drills 13
Common Student Questions 13

Exercise 4: Variables and Names 16
What You Should See 17
Study Drills 17
Common Student Questions 17

Exercise 5: More Variables and Printing 20
What You Should See 20
Study Drills 21
Common Student Questions 21

Exercise 6: Strings and Text 22
What You Should See 23
Study Drills 23
Break It 23
Common Student Questions 24

Exercise 7: Combining Strings 26
What You Should See 26
Study Drills 26
Break It 27
Common Student Questions 27

Exercise 8: Formatting Strings Manually 28
What You Should See 28
Study Drills 29
Common Student Questions 29

Exercise 9: Multi-Line Strings 30
What You Should See 30
Study Drills 31
Common Student Questions 31

Exercise 10: Escape Codes in Strings 32
What You Should See 33
Escape Sequences 33
Study Drills 34
Common Student Questions 34

Exercise 11: Asking People Questions 36
What You Should See 36
Study Drills 37
Common Student Questions 37

Exercise 12: An Easier Way to Prompt 38
What You Should See 38
Study Drills 38
Common Student Questions 39

Exercise 13: Parameters, Unpacking, Variables 40
Code Description 41
Hold Up! Features Have Another Name 42
What You Should See 42
Study Drills 43
Common Student Questions 43

Exercise 14: Prompting and Passing 46
What You Should See 47
Study Drills 47
Common Student Questions 47

Exercise 15: Reading Files 50
What You Should See 51
Study Drills 51
Common Student Questions 52

Exercise 16: Reading and Writing Files 54
What You Should See 55
Study Drills 55
Common Student Questions 56

Exercise 17: More Files 58
What You Should See 59
Study Drills 59
Common Student Questions 59

Module 2: The Basics of Programming 61

Exercise 18: Names, Variables, Code, Functions 62
Exercise Code 63
What You Should See 65
Study Drills 65
Common Student Questions 66

Exercise 19: Functions and Variables 68
What You Should See 69
Study Drills 70
Common Student Questions 70

Exercise 20: Functions and Files 72
What You Should See 73
Study Drills 73
Common Student Questions 74

Exercise 21: Functions Can Return Something 76
What You Should See 77
Study Drills 77
Common Student Questions 78

Exercise 22: Strings, Bytes, and Character Encodings 80
Initial Research 80
Switches, Conventions, and Encodings 82
Dissecting the Output 84
Dissecting the Code 84
Encodings Deep Dive 86
Breaking It 87

Exercise 23: Introductory Lists 88
Accessing Elements of a List 88
Practicing Lists 89
The Code 89
The Challenge 90
Final Challenge 91

Exercise 24: Introductory Dictionaries 92
Key/Value Structures 92
Combining Lists with Data Objects 93
The Code 94
What You Should See 95
The Challenge 95
Final Challenge 96

Exercise 25: Dictionaries and Functions 98
Step 1: Function Names Are Variables 98
Step 2: Dictionaries with Variables 98
Step 3: Dictionaries with Functions 99
Step 4: Deciphering the Last Line 99
Study Drill 100

Exercise 26: Dictionaries and Modules 102
Step 1: Review of import 102
Step 2: Find the __dict__ 102
Step 3: Change the __dict__ 103
Study Drill: Find the "Dunders" 104

Exercise 27: The Five Simple Rules to the Game of Code 106
Rule 1: Everything Is a Sequence of Instructions 106
Rule 2: Jumps Make the Sequence Non-Linear 108
Rule 3: Tests Control Jumps 110
Rule 4: Storage Controls Tests 111
Rule 5: Input/Output Controls Storage 112
Putting It All Together 113

Exercise 28: Memorizing Logic 116
The Truth Terms 116
The Truth Tables 117
Common Student Questions 119

Exercise 29: Boolean Practice 120
What You Should See 122
Study Drills 122
Common Student Questions 122

Exercise 30: What If 124
What You Should See 124
dis() It 125
Study Drill 125
Common Student Questions 125

Exercise 31: Else and If 126
What You Should See 127
dis() It 127
Study Drills 128
Common Student Questions 128

Exercise 32: Making Decisions 130
What You Should See 131
dis() It 131
Study Drills 132
Common Student Questions 132

Exercise 33: Loops and Lists 134
What You Should See 135
dis() It 136
Study Drills 137
Common Student Questions 137

Exercise 34: While Loops 138
What You Should See 139
dis() It 139
Study Drills 140
Common Student Questions 140

Exercise 35: Branches and Functions 142
What You Should See 143
Study Drills 144
Common Student Questions 144

Exercise 36: Designing and Debugging 146
From Idea to Working Code 146
Rules for If-Statements 149
Rules for Loops 149
Tips for Debugging 149
Homework 150

Exercise 37: Symbol Review 152
Keywords 152
Data Types 153
String Escape Sequences 154
Old-Style String Formats 154
Operators 155
Reading Code 156
Study Drills 157
Common Student Questions 157

Module 3: Applying What You Know 159

Exercise 38: Beyond Jupyter for Windows 160
Why Learn PowerShell? 161
What Is PowerShell? 161
Crash Landing 171

Exercise 39: Beyond Jupyter for macOS/Linux 172
Why Learn Bash or ZSH? 173
What Is Bash? 173
Crash Landing 184

Exercise 40: Advanced Developer Tools 186
Managing conda Environments 186
Adding conda-forge 187
Using pip 188
Using a .condarc 188
General Editing Tips 189
Going Further 189

Exercise 41: A Project Skeleton 190
Activate an Environment 190
Just Use cookiecutter 190
Building Your Project 191
Installing Your Project 191
Testing the Install 192
Remove test-project 192
Common Errors 193
Study Drills 193

Exercise 42: Doing Things to Lists 194
What You Should See 195
What Lists Can Do 196
When to Use Lists 197
Study Drills 197
Common Student Questions 198

Exercise 43: Doing Things to Dictionaries 200
A Dictionary Example 201
What You Should See 203
What Dictionaries Can Do 203
Study Drills 204
Common Student Questions 204

Exercise 44: From Dictionaries to Objects 206
Step 1: Passing a Dict to a Function 206
Step 2: talk inside the Dict 207
Step 3: Closures 208
Step 4: A Person Constructor 209
Study Drills 211

Exercise 45: Basic Object-Oriented Programming 212
Python's People 212
Using dir() and __dict__ 213
About the Dot (.) 214
Terminology 215
A Word on self 216
Study Drills 217
Common Student Questions 217

Exercise 46: Inheritance and Advanced OOP 218
How This Looks in Code 219
About class Name(object) 221
Study Drills 221
Common Student Questions 222

Exercise 47: Basic Object-Oriented Analysis and Design 224
The Analysis of a Simple Game Engine 225
Top Down versus Bottom Up 229
The Code for "Gothons from Planet Percal #25" 230
What You Should See 236
Study Drills 237
Common Student Questions 237

Exercise 48: Inheritance versus Composition 238
What Is Inheritance? 238
The Reason for super() 243
Composition 243
When to Use Inheritance or Composition 245
Study Drill 245
Common Student Questions 246

Exercise 49: You Make a Game 248
Evaluating Your Game 248
Function Style 249
Class Style 249
Code Style 250
Good Comments 250
Evaluate Your Game 250

Exercise 50: Automated Testing 252
What Is the Purpose of Testing? 252
How to Test Efficiently 252
Install PyTest 253
Simple PyTest Demo 254
Running pytest 255
Exceptions and try/except 255
Getting Coverage Reports 256
Study Drills 256
Common Student Questions 257

Module 4: Python and Data Science 259

Exercise 51: What Is Data Munging? 260
Why Data Munging? 261
The Problem 261
The Setup 262
How to Code 262
Process Example 263
Solution Strategies 265
Awesome ETL Tools 266
Study Drills 266

Exercise 52: Scraping Data from the Web 268
Introducing with 268
The Problem 269
The Setup 269
The Clue 270
Awesome Scraping Tools 270
Study Drills 271

Exercise 53: Getting Data from APIs 272
Introducing JSON 272
The Problem 273
The Setup 274
The Clue 274
Awesome API Tools 275
Study Drills 275

Exercise 54: Data Conversion with pandas 276
Introducing Pandoc 276
The Problem 276
The Setup 277
The Clue 277
Study Drills 278

Exercise 55: How to Read Documentation (Featuring pandas) 280
Why Programmer Documentation Sucks 280
How to Actively Read Programmer Docs 281
Step #1: Find the Docs 281
Step #2: Determine Your Strategy 282
Step #3: Code First, Docs Second 283
Step #4: Break or Change the Code 283
Step #5: Take Notes 284
Step #6: Use It on Your Own 284
Step #7: Write About What You Learned 284
Step #8: What’s the Gestalt? 285
Reading My pandas Curriculum 286

Exercise 56: Using Only pandas 288
Make a Project 288
The Problem 288
The Setup 289
Study Drill 289

Exercise 57: The SQL Crash Course 290
What Is SQL? 290
The Setup 291
Fixing and Loading 292
Create, Read, Update, Delete 293
SELECT 293
Date and Time 294
INSERT 295
UPDATE 296
DELETE and Transactions 297
Math, Aggregates, and GROUP BY 298
Python Access 299

Exercise 58: SQL Normalization 300
What Is Normalization? 300
First Normal Form 301
Second Normal Form (2NF) 303
Querying 2NF Data 306
Querying with Joins 308
Study Drills 308

Exercise 59: SQL Relationships 310
One-to-Many (1:M) 310
Many-to-Many (M:M) 311
One-to-One (1:1) 312
Attributed Relations 313
Querying M:M Tables 313
Your Last Study Drill 314

Exercise 60: Advice from an Even Older Programmer 316

Index 318


Best Seller

| | See All


Product Details
  • ISBN-13: 9780138270582
  • Publisher: Pearson Education (US)
  • Publisher Imprint: Addison Wesley
  • Language: English
  • ISBN-10: 0138270589
  • Publisher Date: 08 Mar 2024
  • Binding: Digital download


Similar Products

How would you rate your experience shopping for books on Bookswagon?

Add Photo
Add Photo

Customer Reviews

REVIEWS           
Click Here To Be The First to Review this Product
Learn Python the Hard Way
Pearson Education (US) -
Learn Python the Hard Way
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

Learn Python the Hard Way

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book
    Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept

    New Arrivals

    | | See All


    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!
    ASK VIDYA