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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

rounds a number upwards to a whole number

A

print(math.ceil(pi))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

rounds a number downwards to a whole number

A

print(math.floor(pi))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

prints how far a number is from zero

A

print(abs(pi))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

square operator

A

**

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

fins the square root of a number/variable

A

print(math.sqrt(420))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

find the highest number among different variables

A

print(max(x,y,z,pi))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

finds the lowest number among different variables

A

print(min(x,y,z,pi))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly