Start free trial
Trending New Genres Authors
EnglishEnglish
EspañolSpanish
简体中文Chinese
繁體中文Chinese (Traditional)
FrançaisFrench
DeutschGerman
日本語Japanese
PortuguêsPortuguese
ItalianoItalian
한국어Korean
РусскийRussian
NederlandsDutch
العربيةArabic
PolskiPolish
हिन्दीHindi
Tiếng ViệtVietnamese
SvenskaSwedish
ΕλληνικάGreek
TürkçeTurkish
ไทยThai
ČeštinaCzech
RomânăRomanian
MagyarHungarian
УкраїнськаUkrainian
IndonesiaIndonesian
DanskDanish
SuomiFinnish
БългарскиBulgarian
עבריתHebrew
NorskNorwegian
HrvatskiCroatian
CatalàCatalan
SlovenčinaSlovak
LietuviųLithuanian
SlovenščinaSlovenian
СрпскиSerbian
EestiEstonian
LatviešuLatvian
فارسیPersian
മലയാളംMalayalam
தமிழ்Tamil
اردوUrdu
Searching...
SoBrief
Learn Python 3 the Hard Way

Learn Python 3 the Hard Way

A Very Simple Introduction to the Terrifyingly Beautiful World of Computers and Code
Build real Python programs from the first line, and learn how to debug when they break.
by Zed A. Shaw 2017 319 pages
3.92
500+ ratings
Listen
Immersive
V2.3
Amazon Kindle Audible
Try Full Access for 3 Days
Unlock listening & more!
Continue

Key Takeaways

Type code yourself; train your eye to catch tiny differences.

Repetition has a purpose. The book’s “hard way” is a sequence of small, controlled exercises. Learners type each example, run it, compare the result, and correct mistakes. The aim is not just to memorize Python syntax. It is to develop three practical habits: reading code, handling the details of unfamiliar symbols, and noticing differences between similar lines. A missing quote can stop a program; a misspelled variable can send a calculation astray.

Practice before fluency. Shaw compares programming practice with learning guitar and drawing: basic movements can feel tedious before they become natural. The exercises begin with printing text, then gradually introduce variables, files, functions, logic, and projects. The sequence is designed to make each new difficulty less alien than the last.

Analysis

The book treats typing as a form of deliberate attention, not clerical labor. Reproducing code gives beginners immediate, concrete feedback about punctuation and structure, much as practicing scales makes a musician’s movements more reliable. Yet imitation alone has a ceiling: a learner can copy accurately without understanding why the program works. The book addresses that risk through drills that ask readers to alter, break, explain, and rebuild examples. The useful principle is to move from copying toward prediction and variation, so fluency becomes a platform for independent problem-solving rather than a performance of neat transcription.

Learn the shell so files, scripts, and errors stop feeling mysterious.

Start with the working loop. Before writing much Python, the book has readers set up a text editor, a terminal, and the interpreter. They create a directory, save a script there, move into that directory, run the script, and check the output. These steps make the basic cycle visible: write a file, execute it, inspect what happened, and make a correction.

Paths are part of programming. The appendix teaches commands for moving through directories, listing files, and copying or viewing them. Knowing where a script lives explains why a command might report that it cannot find the file. The specific editors and Python version in the book reflect its publication era, but the underlying skill is tool independence: learn enough about the shell to operate without a graphical interface doing every step.

Analysis

The terminal can feel like an obscure gateway, but it exposes the mechanics that graphical tools often hide: current location, filenames, arguments, and program output. Learning those mechanics makes errors easier to localize and gives the learner a portable mental model across platforms. The book’s insistence on avoiding integrated development environments is more debatable. A simpler editor can reduce distractions during first lessons, but modern IDEs also reveal variable values, documentation, and errors. The deeper lesson is not to reject tools; it is to understand the process well enough that a tool remains an aid, not a substitute for comprehension.

Debug by gathering evidence, not by staring harder.

Errors contain clues. A Python error often identifies a file and line, displays the troublesome code, and points near the problem. For example, an unfinished string can produce a syntax error because Python never finds the closing quote. The message may be cryptic, but its location and caret narrow the search. The book’s routine is to compare the typed program with the intended one, check names and punctuation, and read lines backward or aloud when necessary.

Make the program observable. When the cause is unclear, print variable values at strategic points, simplify the code, or deliberately break a working example and watch what changes. This shifts debugging from guessing to asking focused questions: what value reached this point, and what did the program do with it?

Analysis

This is a practical version of hypothesis testing. A bug is not solved by increasing the intensity of attention to the same evidence; it is solved by producing evidence that distinguishes possible causes. Printing a variable, isolating a function, or changing one line at a time turns an opaque failure into a sequence of testable claims. The book’s rejection of debuggers is too categorical: stepping tools can be valuable when a learner knows what question to ask. But the central warning holds. A debugger that displays everything without a guiding hypothesis can overwhelm rather than clarify.

Treat text and bytes as different representations that must be converted.

Text has an encoding. A program’s visible characters are not stored as letters in a computer. They are represented using agreed conventions that map characters to numbers and numbers to bytes. ASCII covers a limited set of characters; Unicode provides a much broader character repertoire, and UTF-8 is a common way to encode Unicode text as bytes.

Convert deliberately. Python distinguishes text strings from raw byte sequences. Encoding turns a string into bytes for storage or transmission; decoding turns bytes into text according to a chosen encoding. The book uses the mnemonic DBES, meaning “Decode Bytes, Encode Strings,” and has readers compare UTF-8, UTF-16, and Big5, including cases where a character cannot be represented. An error-handling option can replace characters the selected encoding cannot express.

Analysis

The distinction matters because data can survive a program while its meaning does not. A file of bytes interpreted with the wrong encoding may show corrupted characters, even when no bytes have vanished. This exercise also models a broader engineering habit: name the representation at each boundary rather than treating all data as interchangeable. One simplification in the book deserves care. Python text strings are Unicode values, not simply UTF-8 byte sequences held internally. The exercise’s practical advice remains sound: make encoding and decoding explicit when moving between text and byte-oriented systems.

Use functions to package steps and return results, not merely print them.

A function names a task. The book introduces a function as a small reusable unit that can accept arguments. A function for printing two values can be called with different inputs; a file-reading function can receive a file object and read from it. Variables inside a function are local to that call, while arguments carry in the values the function needs.

Separate action from result. Printing displays information to a person; returning gives a value back to the code that called the function. The arithmetic exercise makes this distinction visible: functions add, subtract, multiply, or divide, then return the answer so another expression can use it. Chaining returned values creates a calculation from smaller named operations, which is easier to trace than one unexplained block.

Analysis

Functions create boundaries that reduce the amount of code a reader must hold in mind at once. Naming a unit of work lets a program communicate its structure, while parameters make the unit useful in more than one situation. The print-versus-return distinction is especially important because it separates a program’s internal computation from its presentation to a user. This is also a design choice: a function that only prints is harder to reuse in a different context than one that returns data. Small functions help, but excessive fragmentation can hide the overall flow, so names and boundaries should clarify rather than merely multiply.

Trace Boolean decisions and loop state to see where execution goes.

Conditions choose a path. Boolean expressions evaluate a condition, and an `if`, `elif`, or `else` block determines which indented code runs. In the book’s text adventure, a choice such as entering one door leads to another prompt and another decision. Combining conditions with `and`, `or`, and `not` lets the program express more than a single yes-or-no test.

Loops repeat work. A `for` loop processes items in a collection or range. A `while` loop repeats while its condition remains true, so its state must change or the program may never stop. In a counting example, the value is added to a list and then incremented. Printing the value at the top and bottom of each pass makes the loop’s movement visible.

Analysis

Control flow is easier to understand as a trace than as a block of text. At each decision, ask which condition is true; at each loop, record the state before and after one pass. This resembles tracing a proof: every step should follow from the previous state. The book’s preference for for loops when the number of items is bounded is a useful safety default, since it reduces the chance of an accidental endless loop. Its strict rules for conditional structure are best treated as beginner scaffolding, not universal law. Real programs sometimes need branching patterns more complex than a tidy one-level choice.

Choose lists for ordered sequences and dictionaries for named lookups.

Lists keep a sequence. A list stores items in order, supports access by numeric index, and works naturally with loops. Python starts indexes at zero, so the first item is at index zero. The book uses lists for collections of words and for building a sequence one item at a time with `append`.

Dictionaries connect keys to values. A dictionary retrieves information through a key rather than a position. In the state-and-city exercise, one dictionary maps state names to abbreviations, while another maps abbreviations to cities. The program can follow those links to look up a city from a full state name. Use a list when sequence and position matter; use a dictionary when the useful question is “what value belongs to this key?”

Analysis

A data structure is a decision about how information will be organized and retrieved. The book’s examples make that decision concrete: a deck-like sequence suits a list, while a glossary-like lookup suits a dictionary. Choosing the structure that matches the question simplifies later code. The distinction also reveals a limit in the examples: real information often needs several relationships at once, and one list or mapping may not capture every constraint. That does not make the lesson inadequate. It gives beginners a reliable first question: will the program mainly move through items in order, or look them up by identity?

Reach for composition before inheritance unless the relationship is genuinely is-a.

Classes organize related behavior. A class defines a kind of thing; an instance is a particular object created from that definition. The book’s `Song` example creates separate song objects, each holding its own lyrics and using a method to print them. It also teaches two relationship labels: “is-a” describes a class relationship, as when a salmon is a fish; “has-a” describes a component relationship, as when a person has a pet.

Inheritance shares behavior, with risks. A child class can inherit a parent’s methods, replace one, or call the parent’s version through `super()`. Composition instead gives an object another object to use. Shaw recommends avoiding multiple inheritance and favoring composition when the parts are not truly members of one family.

Analysis

The key design question is not which object-oriented feature looks more sophisticated, but which relationship the program needs to express. Inheritance can make common behavior concise when subclasses are genuinely substitutable for their parent. A sprawling hierarchy, however, makes behavior harder to locate and changes risky. Composition makes dependencies explicit and often permits more flexible combinations, although it can introduce extra delegation. The book’s caution is valuable because beginners can mistake code reuse for conceptual sameness. A shared implementation detail does not automatically mean two things should share an ancestry.

Map a problem into concepts, then let a running prototype correct your map.

Start outside the code. For the Gothons adventure, Shaw first describes the story, then lists its important concepts, such as scenes, a map, and an engine. He turns those concepts into a rough class structure and identifies actions the program needs, such as entering a scene or finding the next one. The initial code can be a skeleton with empty methods, enough to test whether the structure makes sense.

Refine in either direction. A top-down approach starts with the broad problem and works toward implementation. A bottom-up approach begins with a small working piece, then extracts larger concepts. The book treats both as useful: the process is iterative, and a difficult subproblem can be analyzed on its own before being folded back into the whole.

Analysis

The Gothons game gives abstraction a narrative anchor: rooms are not merely classes, they are places a player moves through, and the map expresses possible transitions. Writing and drawing first helps expose missing assumptions before they harden into code. Still, extracting nouns and verbs is a heuristic, not an automatic design machine. A noun may be data rather than an object, and a verb may belong to an engine rather than a scene. The stronger method is the book’s full cycle: describe, model, test, and revise when the running program reveals that the model is wrong.

Write tests that fail first, then let each small change earn confidence.

A test checks a promise. The book’s `Room` example creates rooms, connects them with paths, and verifies that following a direction returns the expected destination. Automated tests replace repeated manual checking with a repeatable check that can run after changes. They do not prove a program has no bugs, but they can catch regressions and make expected behavior explicit.

Build in small increments. The test-first exercise begins with a test for a scanner that classifies words. The learner adds one small test, confirms that it fails for the missing feature, writes enough code to pass it, and repeats. The book also recommends running code frequently and refactoring, meaning changing its structure to make it clearer or more useful without losing its intended behavior.

Analysis

A failing test is useful because it demonstrates that the test can detect the absence of the behavior it describes. Passing tests then provide a limited but valuable safety net for revision. This creates a short feedback loop between specification and implementation, reducing the cost of discovering misunderstandings. The book correctly warns that tests do not find every defect; the quality of the test cases matters, and passing examples cannot guarantee correct behavior for untested inputs. Its emphasis on small increments is therefore essential: tests support judgment, they do not replace it.

Learn another language by building familiar programs, reading code, and making something.

A book is a beginning. The exercises move from a first printed message to a text adventure, a project skeleton, automated tests, and a small Flask web application. That progression shows how basic Python ideas can be assembled into a larger artifact: a browser sends a request, a route handles it, and a response or template goes back to the browser. Forms and sessions extend the same project into interactive input and game state.

Continue by doing. Shaw’s proposed learning sequence is to work through an introduction, type and run its examples, take notes, make familiar small programs, and read other people’s code. Documentation and search are part of the work. The goal is not instant mastery, but enough foundation to pursue another project or tool independently.

Analysis

The strongest ending is practical rather than credential-based: a beginner leaves with a method for continuing. Rebuilding a familiar program in a new language tests whether concepts have transferred, while reading other people’s code exposes conventions that tutorials may omit. The web-game exercises also show why programming is more than syntax: it connects user choices, stored state, server behavior, and visible output. The book’s “black belt” metaphor should not be read as expertise. Its real achievement is a beginner’s capacity to learn the next layer, including the ability to recognize what remains unknown.

Analysis

This book is best understood as a course in beginner habits delivered through Python, rather than as a compact reference to the language. Its structure is cumulative and exercise-driven: first establish a working environment, then practice small expressions, then combine them into programs with state, branching, data structures, objects, tests, and a web interface. The final Gothons game gives the technical progression a story-shaped destination. A reader starts by printing a line and ends by considering how a browser, a server, a map, and a user’s choices can form one system.

The central pedagogical bet is that procedural fluency makes abstraction less intimidating. Repeatedly typing punctuation and watching the interpreter respond gives beginners a concrete vocabulary for later concepts. The book strengthens this with deliberate variation: readers are asked to predict outputs, break programs, inspect errors, and trace values. That alternation between imitation and diagnosis is more effective than passive explanation because it makes the learner responsible for producing evidence.

The method also has tensions. Repetition can become mechanical unless it leads to transfer, and rigid setup rules can turn tool preference into a distraction. Some advice reflects its 2017 context, including Python 3.6, Atom, and the nose testing package. Those details should not be mistaken for timeless recommendations. The durable ideas are more general: use a simple, understandable workflow; run small pieces early; read errors as information; and automate checks when repetition becomes burdensome.

The book’s treatment of object-oriented design is intentionally provisional. Its analogies help establish vocabulary, while its warning about inheritance encourages restraint. The larger lesson is not that one programming style always wins, but that structures should clarify relationships and make change manageable. Likewise, the exercises do not make someone a professional programmer. They provide a sturdy launch point: enough syntax, mental models, and learning practice to build something modest, inspect it, and keep going.

Summary in 30 Seconds
Programming fluency grows through active practice: type examples, run them, predict results, and investigate errors. Use the shell to manage files and execute scripts. Build programs from functions, decisions, loops, and data structures, keeping text and bytes distinct. Prefer composition when objects have components rather than a true shared identity. Write tests that expose missing behavior, then make small changes and rerun them. A working project provides a base for learning other languages.
Contains spoilers

Last updated:

Report Issue

Review Summary

3.92 out of 5
Average of 500+ ratings from Goodreads and Amazon.

Learn Python 3 the Hard Way receives mixed reviews. Many find it helpful for beginners, praising its practical approach and emphasis on coding practice. The book's straightforward style and thorough coverage of basics are appreciated. However, some criticize the author's condescending tone and abrupt increase in difficulty towards the end. Readers note that while it's good for learning syntax, it may not be ideal for understanding more complex concepts. The book's outdated content and lack of explanation for certain topics are also mentioned as drawbacks.

Your rating:
4.44
174 ratings
Want to read the full book?

Glossary

instruction

skill-building exercise sequence

The book uses instruction to mean a sequence of controlled exercises that develops a skill through repeated practice. In this approach, learners first reproduce small examples, then explain, modify, and combine them. The aim is to establish basic fluency before asking beginners to handle more complex programming problems.

DBES

bytes decode, strings encode

DBES is the book’s mnemonic for remembering two text conversions: decode bytes to obtain a string, and encode a string to obtain bytes. It is used when Python text must be converted for storage, transmission, or interpretation under a particular character encoding. The mnemonic is a reminder about conversion direction, not a description of every internal detail of Python strings.

is-a

class inheritance relationship

The phrase “is-a” describes a relationship in which one class is a more specific kind of another. In the book’s example, a salmon is a fish. In Python, this relationship is commonly represented through inheritance, where a child class can use behavior defined by a parent class. The relationship should reflect the concepts being modeled, not merely an opportunity to reuse code.

has-a

component or attribute relationship

The phrase “has-a” describes a relationship in which an object contains, refers to, or uses another object as one of its parts. The book illustrates this with a person who has a pet. This is distinct from inheritance: the person is not a kind of pet. Such relationships often lead to composition, where one object delegates work to another.

composition

build behavior from components

Composition organizes a program by having objects use other objects or modules to perform work. Instead of inheriting behavior from a parent class, an object holds a component and calls its functions. The book presents composition as a way to reuse code across unrelated situations and as an alternative to inheritance when there is no genuine “is-a” relationship.

top down

abstract idea toward implementation

A top-down design process begins with a broad description of a problem and gradually turns it into concepts, relationships, classes, functions, and runnable code. In the book’s game example, the designer describes the adventure, identifies scenes and an engine, sketches their relationships, and then creates a working structure. The process can loop back when implementation reveals missing information.

bottom up

working code toward abstraction

A bottom-up design process begins with a small piece of code that barely solves part of a problem. The programmer refines it, tests it, identifies the concepts it uses, and gradually integrates it into a larger design. The book contrasts this with starting from an abstract overview, while treating both approaches as useful at different stages of problem-solving.

test first

test before implementation

Test first is a programming tactic in which a test describing desired behavior is written before the code that provides it. The learner runs the test to confirm that it fails for the missing feature, implements a small change, and repeats the cycle. The book uses this process to build a word scanner and emphasizes solving a large task through small, verifiable steps.

refactoring

restructure without changing purpose

Refactoring is the process of changing existing code to improve its organization or clarity while preserving its intended behavior. In the book, an earlier adventure game is reshaped into a structure that can be tested and run through a web application. Automated tests help check that changes to the internal design have not broken the behavior that the program is meant to provide.

About the Author

Shaw Zed A. is the author of "Learn Python 3 the Hard Way." He is known for his unconventional teaching methods and direct writing style. Shaw emphasizes a hands-on approach to learning programming, often encouraging readers to type out code manually rather than copy-pasting. His books are designed to simulate real-world programming experiences, including the frustrations and challenges that come with it. Shaw is critical of certain programming practices and tools, including IDEs and aspects of object-oriented programming. He has written other programming books in the "Learn the Hard Way" series, covering various programming languages and concepts.

Download PDF

To save this Learn Python 3 the Hard Way summary for later, download the free PDF. You can print it out, or read offline at your convenience.
Download PDF
File size: 0.37 MB     Pages: 19

Download EPUB

To read this Learn Python 3 the Hard Way summary on your e-reader device or app, download the free EPUB. The .epub digital book format is ideal for reading ebooks on phones, tablets, and e-readers.
Download EPUB
File size: 1.42 MB     Pages: 21
Want to read the full book?
Follow
Listen
Home
Swipe
Library
Get App
Try Full Access for 3 Days
Listen, bookmark, and more
Compare Features Free Pro
📖 Read Summaries
Read unlimited summaries. Free users get 3 per month
🎧 Listen to Summaries
Listen to unlimited summaries in 40 languages
—
❤️ Unlimited Bookmarks
Free users are limited to 4
—
📜 Unlimited History
Free users are limited to 4
—
📥 Unlimited Downloads
Free users are limited to 1
—
Risk-Free Timeline
Today: Get Instant Access
Listen to full summaries of 26,000+ books. That's 12,000+ hours of audio!
Day 2: Trial Reminder
We'll send you a notification that your trial is ending soon.
Day 3: Your subscription begins
You'll be charged on Nov 24,
cancel anytime before.
Consume 2.8× More Books
2.8× more books Listening Reading
Our users love us
1M+ readers
Trustpilot Rating
TrustPilot
4.6 Excellent
This site is a total game-changer. I've been flying through book summaries like never before. Highly, highly recommend.
— Dave G
Worth my money and time, and really well made. I've never seen this quality of summaries on other websites. Very helpful!
— Em
Highly recommended!! Fantastic service. Perfect for those that want a little more than a teaser but not all the intricate details of a full audio book.
— Greg M
Save 62%
Yearly
$119.88 $44.99/year/yr
$3.75/mo
Monthly
$9.99/mo
Start a 3-Day Free Trial
3 days free, then $44.99/year. Cancel anytime.
Unlock a world of fiction & nonfiction books
26,000+ books for the price of 2 books
Read any book in 10 minutes
Discover new books like Tinder
Request any book if it's not summarized
Read more books than anyone you know
#1 app for book lovers
Lifelike & immersive summaries
30-day money-back guarantee
Download summaries in EPUBs or PDFs
Cancel anytime in a few clicks

Why one summary?

Scanner
Find a barcode to scan

⭐
⭐
⭐
We have a special gift for you
Open
38% off
DISCOUNT FOR YOU
⭐
⭐
⭐
$79.99
$49.99/year
Only $4.16 per month
Continue
2 taps to start, super easy to cancel
Settings
General
Widget
Loading...