2MAKING TEDIOUS ARITHMETIC FUN WITH LISTS AND LOOPS

“You mean I have to go again tomorrow?” —Aidan Farrell after the first day of school

image

Most people think of doing arithmetic when they think of math: adding, subtracting, multiplying, and dividing. Although doing arithmetic is pretty easy using calculators and computers, it can still involve a lot of repetitive tasks. For example, to add 20 different numbers using a calculator, you have to enter the + operator 19 times!

In this chapter you learn how to automate some of the tedious parts of arithmetic using Python. First, you learn about math operators and the different data types you can use in ...

Get Math Adventures with Python 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.