Vidyalelo
Python · Q57

Python Built

Programming · Python · question 57

Q57

What will be the output of the following code:my_list = [1, 2, 3, 4]print(len(my_list))

A.
4
Answer
B.
[1, 2, 3, 4]
C.
10
D.
6

Answer: Option A

Solution

Answer: Option A
Solution:
The len() function in Python is used to find the number of elements in an object. In this case, len(my_list) will return the length of the list my_list, which contains four elements [1, 2, 3, 4]. Therefore, the output will be 4.