=====Problem Statement=====
Consider a list (list = []). You can perform the following commands:
1. insert i e: Insert integer e at position i.
2. print: Print the list.
3. remove e: Delete the first occurrence of integer e.
4. append e: Insert integer e at the end of the list.
5. sort: Sort the list.
6. pop: Pop the last element from the list.
7. reverse: Reverse the list.
Initialize your list and read in the value of n followed by n lines of commands where each command will be 7 of the types listed above. Iterate through each command in order and perform the corresponding operation on your list.

=====Example=====
N = 4
append 1
append 2
insert 3 1
print
append 1: Append 1 to the list, arr = [1].
append 2: Append 2 to the list, arr = [1,2].
insert 3 1: Insert 3 at index 1, arr = [1,3,2].
print: Print the array
Output:
[1, 3, 2]

=====Input Format=====
The first line contains an integer, n, denoting the number of commands. Each line i of the subsequent n lines contains one of the commands described above.

=====Constraints=====
The elements added to the list must be integers

=====Output Format=====
For each command of type print, print the list on a new line.

Difficulty: introductory

Starter code:

if __name__ == '__main__':
    N = int(input())

Solutions:
# Enter your code here. Read input from STDIN. Print output to STDOUT
ar=[]
n=int(input())
for i in range(0,n):
    tmp_str=input()
    tmp_str_ar=tmp_str.strip().split(" ")
    cmd=tmp_str_ar[0]
    if(cmd=="print"):
        print(ar)
    elif(cmd=="sort"):
        ar.sort()
    elif(cmd=="reverse"):
        ar.reverse()
    elif(cmd=="pop"):
        ar.pop()
    elif(cmd=="count"):
        val=int(tmp_str_ar[1])
        ar.count(val)
    elif(cmd=="index"):
        val=int(tmp_str_ar[1])
        ar.index(val)
    elif(cmd=="remove"):
        val=int(tmp_str_ar[1])
        ar.remove(val)  
    elif(cmd=="append"):
        val=int(tmp_str_ar[1])
        ar.append(val)          
    elif(cmd=="insert"):
        pos=int(tmp_str_ar[1])
        val=int(tmp_str_ar[2])
        ar.insert(pos,val)


def __starting_point():
    N = int(input())
    outlist = []
    for _ in range(N):
        args = input().strip().split(' ')
        cmd = args[0]
        if cmd == 'insert':
            outlist.insert(int(args[1]), int(args[2]))
        elif cmd == 'remove':
            outlist.remove(int(args[1]))
        elif cmd == 'append':
            outlist.append(int(args[1]))
        elif cmd == 'print':
            print(outlist)
        elif cmd == 'sort':
            outlist.sort()
        elif cmd == 'pop':
            outlist.pop()
        elif cmd == 'reverse':
            outlist.reverse()
        
        
            

__starting_point()