xxxxxxxxxx
# Using 'reverse' (List Method):
# Note: can't be used for string, only list
my_list = [1, 2, 3, 4, 5]
my_list.reverse() # Reverses the original list in-place
print(my_list) # Output: [5, 4, 3, 2, 1]
# Using 'reversed' (Built-in Function):
# Note: can use in list or string
my_list = [1, 2, 3, 4, 5]
reversed_list = list(reversed(my_list)) # Creates a reversed iterator and converts it to a list
print(reversed_list) # Output: [5, 4, 3, 2, 1]