Informatics Practices

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

Python Funda

1 Like

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.

Answered By

3 Likes


Related Questions