Suppose there is a list such that: l=. If we want to print this list in reverse order, which of the following methods should be used? ) c) reversed(l) d) list(reversed(l))
Suppose there is a list such that: l=. If we want to print this list in reverse order, which of the following methods should be used? ) c) reversed(l) d) list(reversed(l)) Correct Answer 2,3,4
The built-in function reversed() can be used to reverse the elements of a list. This function accepts only an iterable as an argument. To print the output in the form of a list, we use: list(reversed(l)). The output will be: .