Numbers Flashcards

1
Q

Convert string to floating point

A

float(‘123.45’)

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

Print floating point number with precision

A

print(f’{value:.6f}’)

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

Initialise a variable to negative or positive infinity

A

variable = float(‘inf’)
variable = -float(‘inf’)

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

Convert to integer

A

int(‘123’)

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

Round a number

A

round(number)

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

Round down

A

math.floor(number)

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

Round up

A

math.ceil(number)

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

Integer division

A

4 // 2

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

Find remainder of division

A

Number % divisor

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

Find min of list

A

min(numbers)

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

Find min of list

A

min(numbers)

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

Find max of list

A

max(numbers)

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