9951 explained code solutions for 126 technologies


pythonReverse a list using slicing


list_a = ["foo", "bar", "baz"]
list_reversed = list_a[::-1]

print(list_reversed)ctrl + c
[::-1]

slicing operator where the index is accessed as [start:stop:step]. If you define the -1 step, the program will count the reverse index list(from the end to the beggining)