ExamVeda
Login
Home
Python Built In Functions
?

What is the output of the following code:
my_list = [1, 2, 3]
print(list(reversed(my_list)))

Answer & Solution
Correct Answer: Option A
The correct answer is Option A: [3, 2, 1].
The reversed() function in Python is used to reverse the elements of an iterable. When you pass the list [1, 2, 3] to the reversed() function and then convert the result to a list using list(), it returns a new list with the elements reversed, resulting in [3, 2, 1].
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.