Chapter 3. Numbers and Variables: Python Does the Math
Weâve used Python to do really fun things, like make colorful pictures in just a few lines of code, but our programs have been limited. We just ran them and watched them make pictures. What if we wanted to interact with our Python programs? In this chapter, weâll learn how to have Python ask the userâs name and even offer to do the userâs math homework!
Variables: Where We Keep Our Stuff
In Chapter 1 and Chapter 2, we used a few variables (you might remember name
from our first program in Chapter 1 or x
and sides
from Chapter 2). Now letâs look at what variables really are and how they work.
A variable is something you want the computer to remember while your program is running. ...
Get Teach Your Kids to Code now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.