Question 7: What is the output of the following program?
T = ( 2e - 04 , True , False , 8 , 1.001 , True )
val = 0
for x in T:
val + = int (x)
print (val)
|
(A) 12
(B) 11
(C) 11.001199999999999
(D) TypeError
Answer: (B)
Explanation: Integer value of 2e-04(0.0002) is 0, True holds a value 1 and False a 0, integer value of 1.001 is 1. Thus total 0 + 1 + 0 + 8 + 1 + 1 = 11.
Quiz of this Question
Please comment below if you find anything wrong in the above post
Article Tags :
Recommended Articles