LinkedIn Python Skill Assessment Quiz Answers

What happens when you use the built-in function all() on a list?

Latest Update on 25th January, 2022 by Certification Course Answers

What happens when you use the built-in function all() on a list?

  1.  The all() function returns a Boolean value that answers the question “Are all the items in this list the same?
  2.  The all() function returns True if all the items in the list can be converted to strings. Otherwise, it returns False.
  3.  The all() function will return all the values in the list.
  4.  The all() function returns True if all items in the list evaluate to True. Otherwise, it returns False.

Correct Answer:

  •  The all() function returns True if all items in the list evaluate to True. Otherwise, it returns False.

Explaination: 

all() returns true if all in the list are True, see example below

test = [True,False,False,False]
if all(test) is True:
    print('Yeah all are True')
else:
    print('There is an imposter')
>>> There is an imposter

Latest Updates

No posts found in this category.