Learn Python the Hard Way, 5th Edition (2023-2024)
Yes, it's Python 3! Full Release Date Feb 1, 2024 The latest version of Learn Python the Hard Way teaches you the basics of computer programming from nothing, but focusing on the tools Data Scientists use. Data Science is the most popular way Python is used today, and the tools Data Scientists use are very friendly to beginners. This course will assume you know nothing, so even if you don't want to do Data Science this course will get you on the right path with Python.
UPDATE: All exercises are written and should work. Official release date of the book from Pearson will be Feb, 2024. Videos will be published from Jan 15, 2024 onward. If you find errors let me know at help@learncodethehardway.com.
Course Contents
This course contains the following modules and lessons. Every course offers free samples of the first 10 lessons so you can decide if you want to take the course, and excerpts from all lessons after that.
Module Getting Started in Python
- 0: Gearing UpThis exercise has no code.
- 1: A Good First ProgramIf you skipped Exercise 0, then you are not doing this book right.
- 2: Comments and Pound CharactersComments are very important in your programs.
- 3: Numbers and MathEvery programming language has some kind of way of doing numbers and math.
- 4: Variables and NamesNow you can print things with
print
and you can do math. - 5: More Variables and PrintingNow we'll do even more typing of variables and printing them out.
- 6: Strings and TextWhile you have been writing strings, you still do not know what they do.
- 7: Combining StringsNow we are going to do a bunch of exercises where you just type code in and make it run.
- 8: Formatting Strings ManuallyWe will now see how to do a more complicated formatting of a string.
- 9: Multi-line StringsBy now you should realize the pattern for this book is to use more than one exercise to teach you something new.
- 10: Escape Codes in StringsIn Exercise 9 I threw you some new stuff, just to keep you on your toes.
- 11: Asking People QuestionsNow it is time to pick up the pace.
- 12: An Easier Way to PromptWhen you typed
input()
you were typing the(
and)
characters, which areparenthesis
characters. - 13: Parameters, Unpacking, VariablesWe're now going to take a quick detour into the world of the
Terminal
(akaPowerShell
) version ofpython
. - 14: Prompting and PassingLet's do an exercise that uses
argv
andinput
together to ask the user something specific. - 15: Reading FilesYou know how to get input from a user with
input
orargv
. - 16: Reading and Writing FilesIf you did the Study Drills from the last exercise, you should have seen all sorts of commands (methods/functions) you can give to files.
- 17: More FilesNow let's do a few more things with files.
Module The Basics of Programming
- 18: Names, Variables, Code, FunctionsBig title, right? I am about to introduce you to the function! Dum dum dah! Every programmer will go on and on about functions and all the different ideas about how they work and what they do, but I will give you the simplest explanation you can use right now.
- 19: Functions and VariablesYou're now going to combine functions with what you know of variables from previous exercises.
- 20: Functions and FilesRemember your checklist for functions, then do this exercise paying close attention to how functions and files can work together to make useful stuff.
- 21: Functions Can Return SomethingYou have been using the
=
character to name variables and set them to numbers or strings. - 22: Strings, Bytes, and Character EncodingsTo do this exercise you'll need to download a text file that I've written named `languages.
- 23: Introductory ListsMost programming languages have some way to store data inside the computer.
- 24: Introductory DictionariesIn this exercise we'll use the same data from the previous exercise on
list
s and use it to learn aboutDictionaries
ordict
s. - 25: Dictionaries and FunctionsIn this exercise we're going to do something fun by combining functions with
dict
s. - 26: Dictionaries and ModulesIn this exercise you're going to explore how the
dict
works with modules. - 27: The 5 Simple Rules to the Game of CodeThis exercise is intended to be studied periodically while you study the next exercises.
- 28: Memorizing LogicToday is the day you start learning about logic.
- 29: Boolean PracticeThe logic combinations you learned from the last exercise are called "Boolean" logic expressions.
- 30: What IfHere is the next script of Python you will enter, which introduces you to the
if-statement
. - 31: Else and IfIn the last exercise you worked out some
if-statements
and then tried to guess what they are and how they work. - 32: Making DecisionsIn the first half of this book you mostly just printed out things called functions, but everything was basically in a straight line.
- 33: Loops and ListsYou should now be able to do some programs that are much more interesting.
- 34: While LoopsNow to totally blow your mind with a new loop, the
while-loop
. - 35: Branches and FunctionsYou have learned
if-statements
, functions, and lists. - 36: Designing and DebuggingNow that you know
if-statements
, I'm going to give you some rules forfor-loops
andwhile-loops
that will keep you out of trouble. - 37: Symbol ReviewIt's time to review the symbols and Python words you know and to try to pick up a few more for the next few lessons.
Module Applying What You Know
- 38: Beyond Jupyter for WindowsJupyter is a great environment for interactive analysis.
- 39: Beyond Jupyter for macOS/LinuxJupyter is a great environment for interactive analysis.
- 40: Advanced Developer ToolsThis exercise is all about avoiding "footguns.
- 41: A Project SkeletonThis exercise is completely optional, but useful if you want to create your own package to use in other projects.
- 42: Doing Things to ListsYou have learned about lists.
- 43: Doing Things to DictionariesYou are now going to learn about the Dictionary data structure in Python.
- 44: From Dictionaries to ObjectsYou should review the following exercises before doing this one: Exercise 24 Introductory Dictionaries to refresh your understanding of Dictionaries.
- 45: Basic Object Oriented ProgrammingIn Exercise 44 you learned how to use a function to create special
dict
containers with functions attached to them. - 46: Inheritance and Advanced OOPAn important concept that you have to understand is the difference between a class and an object.
- 47: Basic Object-Oriented Analysis and DesignI'm going to describe a process to use when you want to build something using Python, specifically with object-oriented programming (OOP).
- 48: Inheritance Versus CompositionIn the fairy tales about heroes defeating evil villains there's always a dark forest of some kind.
- 49: You Make a GameYou need to start learning to feed yourself.
- 50: Automated TestingThis final exercise of Module 3 will teach you how to create automated tests.
Module Python and Data Science
- 51: What is Data Munging?At this point in the course you know Python.
- 52: Scraping Data from the WebThe two most popular uses of Python are Data Science and Web Scraping because web scraping typically feeds data to your data science pipeline.
- 53: Getting Data from APIsIn this exercise you'll access the Application Programmer Interface (API) I use for my learncodethehardway.
- 54: Data Conversion with PandasWe'll now explore Pandas(https://pandas.
- 55: How to Read Documentation (featuring Pandas)This exercise is going to teach two very important skills.
- 56: Using Only PandasIn this exercise you'll take the mess of random scripts you've made and create one clean tool that uses only Pandas for the entire process.
- 57: The SQL Crash CourseYou can't do science without data, and the most widely used language for storing and managing data is SQL.
- 58: SQL NormalizationIn the previous exercise we explored SQL basics using the European Central Bank's(https://www.
- 59: SQL RelationshipsOur final exercise is going to cover the concept of relations in SQL.
- 60: Advice from An Even Older ProgrammerImagine it's 1820 and you want a nice portrait of your mother.