In [1]:
org_list = [1, 2, 3, 4, 5]
In [2]:
org_list.reverse()
print(org_list)
In [3]:
print(org_list.reverse())
In [4]:
org_list = [1, 2, 3, 4, 5]
In [5]:
reverse_iterator = reversed(org_list)
print(org_list)
In [6]:
print(type(reverse_iterator))
In [7]:
for i in reversed(org_list):
print(i)
In [8]:
new_list = list(reversed(org_list))
print(org_list)
print(new_list)
In [9]:
org_list = [1, 2, 3, 4, 5]
In [10]:
new_list = org_list[::-1]
print(org_list)
print(new_list)
In [11]:
org_str = 'abcde'
In [12]:
new_str_list = list(reversed(org_str))
print(new_str_list)
In [13]:
new_str = ''.join(list(reversed(org_str)))
print(new_str)
In [14]:
new_str = org_str[::-1]
print(new_str)
In [15]:
org_tuple = (1, 2, 3, 4, 5)
In [16]:
new_tuple = tuple(reversed(org_tuple))
print(new_tuple)
In [17]:
new_tuple = org_tuple[::-1]
print(new_tuple)