1.

What is the result of math.fsum([.1 for i in range(20)])?(a) 2.0(b) 20(c) 2(d) 2.0000000000000004I had been asked this question by my college professor while I was bunking the class.My doubt is from Math in portion Mapping Functions and Modules of Python

Answer»

Right ANSWER is (a) 2.0

Easy EXPLANATION - The FUNCTION fsum returns an ACCURATE floating POINT sum of the elements of its argument.



Discussion

No Comment Found

Related InterviewSolutions