• + 0 comments

    if name == 'main': N = int(input()) l = list()

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