DS160123 Today's challenge

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

@sms18680

Nice question

1 Like

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

@kharshavardhan31
Correct. Keep it up :slightly_smiling_face:

1 Like

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

We had to find option which gives an error @ritheshchandra1707

1 Like

@ritheshchandra1707
Try to answer for value error :slightly_smiling_face:
Keep learning