?
What is the output of the following code:
What is the output of the following code:
my_list = [5, 8, 2, 6]
print(max(my_list))
print(max(my_list))
Answer & Solution
Correct Answer:
Option
A
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.
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
Login to post a comment or share your explanation.
Login