date:- 8/2/2023

Assuming that math module has been imported as follows:

import math as m

Identify the statement that will lead to value error.

(a) print(m.ceil(-2.7)) (b) print(m.floor(-2.7)) (c) print(m.sqrt(-2.7)) (d) print(m.fabs(-2.7))

2 Likes

Answer is **(C)**

`ValueError: math domain error`

As domain for calculating square root values only consists of positive numbers.

for (a), it gives -2 (closest integer value to left of -2.7 on number line)

for (b), it gives -3 (closest integer value to right of -2.7 on number line)

for (d), it gives -2 (absolute(without decimals) value for -2.7)

2 Likes

Assuming that math module has been imported as follows:

import math as m

Identify the statement that will lead to value error.

(a) print(m.ceil(-2.7)) (b) print(m.floor(-2.7)) (c) print(m.sqrt(-2.7)) (d) print(m.fabs(-2.7))

Option (a)

2 Likes