<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Lists
Lists are collections of heterogeneous objects, which can be of any type, including other lists.
Lists in the Python are mutable and can be changed at any time. Lists can be sliced ​​in the same way as strings, but as the lists are mutable, it is possible to make assignments to the list items.
Syntax
Step1:  NOTE
Step2:  Removing
Step3:  Appending
Step4:  Ordering
Step5:  Inverting
Step6:  The function enumerate() returns a tuple of two elements in each iteration
Step7:  The sort (sort) and reversal (reverse) operations are performed in the list and do not create new lists.
Tuples
Similar to lists, but immutable
<ASSISTANT_TASK:>
Python Code:
fruits = ['Apple', 'Mango', 'Grapes', 'Jackfruit', 
          'Apple', 'Banana', 'Grapes', [1, "Orange"]]
# processing the entire list
for fruit in fruits:
     print(fruit,  end=", ")
#
print("*"*30)
fruits.insert(0, "kiwi")
print( fruits)
# help(fruits.insert)
# Including
ft1 = list(fruits)
print(id(ft1))
print(id(fruits))
ft1 = fruits[:]
print(id(ft1))
print(id(fruits))
ft2 = fruits
print(id(ft2))
print(id(fruits))
fruits.append('Camel')
print(fruits)
fruits.append(['kiwi', 'Apple', 'Camel'])
print(fruits)
fruits.extend(['kiwi', 'Apple', 'Camel'])
print(fruits)
Explanation: Lists
Lists are collections of heterogeneous objects, which can be of any type, including other lists.
Lists in the Python are mutable and can be changed at any time. Lists can be sliced ​​in the same way as strings, but as the lists are mutable, it is possible to make assignments to the list items.
Syntax:
python
list = [a, b, ..., z]
Common operations with lists:
End of explanation
fruits.extend(['kiwi', ['Apple', 'Camel']])
print(fruits)
Explanation: NOTE: Only one level of extending happens, apple and camel are still in sub-list
End of explanation
## Removing the second instance of Grapes
x = 0
y = 0
for fruit in fruits:
    if x == 1 and fruit == 'Grapes':
#          del (fruits[y])
        fruits.pop(y)
    elif fruit == 'Grapes':
        x = 1
    y +=1
    
print(fruits)   
fruits.remove('Grapes')
Explanation: Removing
End of explanation
print(fruits)
fruits.append("Grapes")
Explanation: Appending
End of explanation
# These will work on only homogeneous list and will fail for heterogeneous
fruits.sort()
print(fruits)
Explanation: Ordering
End of explanation
fruits.reverse()
print(fruits)
# # # prints with number order
fruits = ['Apple', 'Mango', 'Grapes', 'Jackfruit', 
          'Apple', 'Banana', 'Grapes']
for i, prog in enumerate(fruits):
    print( i + 1, '=>', prog)
Explanation: Inverting
End of explanation
my_list = ['A', 'B', 'C']
for a, b in enumerate(my_list):
    print(a, b)
my_list = ['A', 'B', 'C']
print ('list:', my_list)
# # The empty list is evaluated as false
while my_list:
    # In queues, the first item is the first to go out
    # pop(0) removes and returns the first item 
    print ('Left', my_list.pop(0), ', remain', len(my_list), my_list)
my_list.append("G")
# # More items on the list
my_list += ['D', 'E', 'F']
print ('list:', my_list)
while my_list:
    # On stacks, the first item is the last to go out
    # pop() removes and retorns the last item
    print ('Left', my_list.pop(), ', remain', len(my_list), my_list)
l = ['D', 'E', 'F', "G", "H"]
print(l)
k = ('D', "E", "G", "H")
print(dir(l))
print("*"*8)
print(dir(k))
Explanation: The function enumerate() returns a tuple of two elements in each iteration: a sequence number and an item from the corresponding sequence.
The list has a pop() method that helps the implementation of queues and stacks:
End of explanation
t = ([1, 2], 4)
print(t)
print(" :: Error :: ")
t[0] = 3
print(t)
t[0] = [1, 2, 3]
print(t)
t[0].append(3)
print(t)
t[0][0] = [1, 2, 3]
print(t)
ta = (1, 2, 3, 4, 5)
for a in ta:
    print (a)
ta1 = [1, 2, 3, 4, 5]
for a in ta1:
    print(a)
Explanation: The sort (sort) and reversal (reverse) operations are performed in the list and do not create new lists.
Tuples
Similar to lists, but immutable: it's not possible to append, delete or make assignments to the items.
Syntax:
my_tuple = (a, b, ..., z)
The parentheses are optional.
Feature: a tuple with only one element is represented as:
t1 = (1,)
The tuple elements can be referenced the same way as the elements of a list:
first_element = tuple[0]
Lists can be converted into tuples:
my_tuple = tuple(my_list)
And tuples can be converted into lists:
my_list = list(my_tuple)
While tuple can contain mutable elements, these elements can not undergo assignment, as this would change the reference to the object.
Example (using the interactive mode):
End of explanation
<END_TASK>