1.

What will be the output of print(math.copysign(3, -1))?(a) 1(b) 1.0(c) -3(d) -3.0I had been asked this question during an online interview.Origin of the question is Math topic in portion Mapping Functions and Modules of Python

Answer»

The correct option is (d) -3.0

The BEST explanation: The copysign FUNCTION returns a float whose absolute VALUE is that of the FIRST argument and the sign is that of the second argument.



Discussion

No Comment Found

Related InterviewSolutions