• + 0 comments

    Here is my Code easy to understand:

        N = int(input())
        
        LIST = []
        
        for i in range(N):
            A = input().split(" ")
            if A[0] == "insert":
                LIST.insert(int(A[1]),int(A[2]))
            elif A[0] == "remove":
                LIST.remove(int(A[1]))
            elif A[0] == "sort":
                LIST.sort()
            elif A[0] == "append":
                LIST.append(int(A[1]))
            elif A[0] == "pop":
                LIST.pop()
            elif A[0] == "reverse":
                LIST.reverse()
            elif A[0] == "print":
                print(LIST)