9951 explained code solutions for 126 technologies
list_a = ["foo", "bar", "baz"] list_reversed = list_a[::-1] print(list_reversed)ctrl + cgithub
list_a = ["foo", "bar", "baz"] list_reversed = list_a[::-1] print(list_reversed)
[::-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)
[start:stop:step]
-1