Vidyalelo
Python · Q41

Python Built

Programming · Python · question 41

Q41

What will be the output of the following Python function? all([2,4,0,6])

A.
Error
B.
True
C.
False
Answer
D.
0

Answer: Option C

Solution

Answer: Option C
Solution:
The correct answer is Option C: False.
The all() function in Python returns True if all elements of the iterable are true, and False otherwise. In this case, the iterable is [2,4,0,6][2,4,0,6]. Since the element 0 evaluates to False in a Boolean context, the function will return False. Therefore, the output of the function call all([2, 4, 0, 6]) will be False.