What will be the value of the following Python expression? [code]float(4+int(2.39)%2)[/code]

What will be the value of the following Python expression?
Code:
float(4+int(2.39)%2)
A. 5.0
B. 5
C. 4.0
D. 4
 
Answer: c
Explanation: The above expression is an example of explicit conversion. It is evaluated as:
Code:
float(4+int(2.39)%2)
= float(4+2%2) = float(4+0) = 4.0. Hence the result of this expression is 4.0.
 

Tìm kiếm

Back
Top