all() function: What is the output of all(4, 6, 0, 1)?

  • True
  • False
  • True, True, False, True
  • Error

The all() function tells you whether all the values present in an iterable are True or not. If all the values are True, i.e. none of them is zero, it will return True else it will return False. The above code will throw an error because the function all() can only be applied over an iterable; but here, the arguments have been provided to the function as four distinct numbers. If they had been passed as a list —  i.e. all([4, 6, 0, 1]) — then, you would have gotten an appropriate output (False in this case).