Skip to content

Arithmetic Expressions

Provided Files

Example Code

Model 1 – copy one line at a time into the shell

2 + 3
3 * 4 + 2
3 * 4 + 2.0
3(4 + 2)
3 * (4 + 2)
5 / 10
5 / 10.0
5 / 9
2 ** 4
abs(-2) ** 4
math.pow(2, 4)
import math
math.pow(2, 4)
sqrt(4)
math.sqrt(4)
math.cos(0)
math.pi
math.sin(math.pi / 2)