Chapter 3. Basic Math
When we first tried using Python in interactive mode, we saw that it can do simple arithmetic. Now we’re going to see what else Python can do with numbers and math. You might not realize it, but math is everywhere! Especially in programming, math is used all the time. That doesn’t mean you have to be a math whiz to learn programming, but think about it. Every game has a score of some kind that has to be added up. Graphics are drawn on the screen using numbers to figure out the positions and colors. Moving objects have a direction and speed, which are described with numbers. Almost any interesting program is going to use numbers and math in some way. So let’s learn some basics about math and numbers in Python.
Get Hello World! Third Edition 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.