1.

Which one of these is floor division?(a) /(b) //(c) %(d) None of the mentionedI got this question in class test.Origin of the question is Basic Operators topic in portion Variable Names, Operators, Data Types & Numeric Types of Python

Answer»

Correct option is (B) //

The BEST I can EXPLAIN: When both of the operands are integer then python chops out the fraction part and GIVES you the round off value, to get the ACCURATE answer use floor division. This is floor division. For ex, 5/2 = 2.5 but both of the operands are integer so answer of this expression in python is 2. To get the 2.5 answer, use floor division.



Discussion

No Comment Found

Related InterviewSolutions