?
What will be the output of the following code:
What will be the output of the following code:
my_list = [1, 2, 3, 4]
print(len(my_list))
print(len(my_list))
Answer & Solution
Correct Answer:
Option
A
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.
Join the Discussion
Login to post a comment or share your explanation.
Login