Learn Python the Hard Way: A Deceptively Simple Introduction to the Terrifyingly Beautiful World of Computers and Data Science, 5th Edition
by Zed A. Shaw
Exercise 4
Variables and Names
Now you can print things with print, and you can do math. The next step is to learn about variables. In programming, a variable is nothing more than a name for something, similar to how my name “Zed” is a name for “the human who wrote this book.” Programmers use these variable names to make their code read more like English and because they have lousy memories. If they didn’t use good names for things in their software, they’d get lost when they tried to read their code again.
If you get stuck with this exercise, remember the tricks you have been taught so far for finding differences and focusing on details:
Write a comment above each line explaining to yourself what it does in English
Read your Python code backward ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access