CBSE Class 11 Computer Science Question 38 of 98

Python Programming Fundamentals — Question 17

Back to all questions
17
Question

Question 17

What will be the output of the following Python code?

>>> a=72.55
>>> b=10
>>> c=int(a + b)
>>> c
  1. 72.55
  2. 72
  3. 82
  4. None of these
Answer

82

Reason — In the above code, a is assigned the floating-point number 72.55, and b is assigned the integer 10. The variable c is assigned the expression a + b resulting in 72.55 + 10 = 82.55. Then, the int() function is used to convert the result of a + b to an integer. Therefore, int(82.55) results in 82.