Q. What would be the output produced by the following code:
import math
import random
print (math.ceil(random.random()))
Justify your answer.
Answer :-
The output produced would be: 1.0
Reason being that random.random() would generate a number in the range [0.0, 1.0) but math.ceil() will return ceiling number for this range, which is 1.0 for all the numbers in this range. Thus the output produced will always be 1.0
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )