reverse and reversed in python code example
Example 1: reversed python
seq_string = 'Python'
print(list(reversed(seq_string)))
seq_tuple = ('P', 'y', 't', 'h', 'o', 'n')
print(list(reversed(seq_tuple)))
seq_range = range(5, 9)
print(list(reversed(seq_range)))
seq_list = [1, 2, 4, 3, 5]
print(list(reversed(seq_list)))
Example 2: python get reversed list
list.reverse()
Example 3: reverse() in python
systems = ['Windows', 'macOS', 'Linux']
print('Original List:', systems)
systems.reverse()
print('Updated List:', systems)