reverse a list in python 3 code example
Example 1: python reverse list
list.reverse()
Example 2: reverse element in a list in python 3
my_list = [1, 7, 9, 11, 12, 20]
# Reverse a list by using a slice
print(my_list[::-1])
Example 3: reverse in python 3
# create list of integers or strings
number = [1,2,3,4,5]
# pass the values using the reverse method.
number.reverse()
# Then print the variable as such:
print(number)
Example 4: reverse a list in python
a = ['a', 'b', '4', '5', 'd'] #reverse the List
print(list(reversed(a)))