Examveda

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

A. Error

B. True

C. False

D. 0

Answer: Option C

Solution (By Examveda Team)

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.

This Question Belongs to Python Program >> Python Built In Functions

Join The Discussion

Related Questions on Python Built In Functions