Math

Introduction

You can use Python to solve Math problems!

Python Math Operators

Symbol

Operation

+

addition

-

subtraction

*

multiplication

/

division

//

integer division

**

power or exponent

%

remainder or modulus

()

parenthesis

Python follows the Order of Operations, just like you learned in Math class.

Order of Operations Precedence

Symbols

Parentheses

()

Exponent

**

Multiplication, Division (from left to right)

* / //

Addition, Subtraction (from left to right)

+ -

import math

Python has a number of builtin math methods.

Examples

Write Python code that does the following:

  1. Assign the variable bday to the month of your bday.

  2. Multiply bday by 5.

  3. Add 6 to bday.

  4. Multiply bday by 4.

  5. Add 9 to bday.

  6. Multiply bday by 5.

  7. Add the number number of the day of your bday.

  8. Subtract 165 from bday.

  9. Print the value of bday.

Last updated

Was this helpful?