Chapter 3Calculations

You’ve done some basic math already, but now it’s time to dive into more complex math. The exercises in this chapter are a little more challenging. You’ll work with formulas for numerical conversion and you’ll create some real-world financial programs, too.

These programs will test your knowledge of the order of operations. “Please Excuse My Dear Aunt Sally,” or PEMDAS, is a common way to remember the order of operations:

  • Parentheses

  • Exponents

  • Multiplication

  • Division

  • Addition

  • Subtraction

The computer will always follow these rules, even if you don’t want it to. So the exercises in this chapter will have you thinking about adding parentheses to your programs to ensure the output comes out correctly.

You’ll want to make good ...

Get Exercises for Programmers 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.