Informatics Practices
What will be the output of the following Python code?
>>> a=72.55
>>> b=10
>>> c=int(a + b)
>>> c
- 72.55
- 72
- 82
- 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
2 Likes
Related Questions
What is the result of this statement:
10>5 and 7>12 or not 18>3- 10
- True
- False
- None
What will be the output of the following Python code?
>>> 6*3+4**2//5-8- 13
- 14
- Error
- None
Assertion (A): Each component of a programming statement is known as a token.
Reasoning (R): Token is not executed by Python interpreter, only used in the program coding.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): The data type of a variable is declared as per the type of value assigned to it.
Reasoning (R): Python exhibits the feature of dynamic typing. In dynamic typing, the type of the variable is determined only during runtime.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.