What is the output of the following code:
my_list = [5, 8, 2, 6]
print(max(my_list))
print(max(my_list))
A. 8
B. [5, 8, 2, 6]
C. 21
D. 6
Answer: Option A
Solution (By Examveda Team)
The correct answer is Option A: 8.The max() function in Python is used to find the maximum value among the elements of an iterable, such as a list. When you pass the list [5, 8, 2, 6] to the max() function, it returns the maximum value from the list, which is 8.
Join The Discussion