math functions Flashcards
1
Q
math function that rounds to a decimal or to a whole number
A
whole number: print(round(pi))
to a decimal point: print(round(pi,2)) (rounds to 2 decimals places)
2
Q
rounds a number upwards to a whole number
A
print(math.ceil(pi))
3
Q
rounds a number downwards to a whole number
A
print(math.floor(pi))
4
Q
prints how far a number is from zero
A
print(abs(pi))
5
Q
square operator
A
**
6
Q
fins the square root of a number/variable
A
print(math.sqrt(420))
7
Q
find the highest number among different variables
A
print(max(x,y,z,pi))
8
Q
finds the lowest number among different variables
A
print(min(x,y,z,pi))