Vidyalelo
Python · Q43

Python Introduction and basic

Programming · Python · question 43

Q43

What will be the output of the following Python function? len(["hello",2, 4, 6])

A.
Error
B.
6
C.
4
Answer
D.
3

Answer: Option C

Solution

Answer: Option C
Solution:
The len() function returns the number of items in an object.
Here, we have a list ["hello", 2, 4, 6].
The list contains 4 items: a string, two integers, and another integer.
Therefore, the output of len(["hello", 2, 4, 6]) will be 4.