• + 0 comments
    if __name__ == '__main__':
        anslist=[] #What the output will give
        #inputtedList=[] #How we split the inputs
        N = int(input())
        for i in range(N):
            inputedcommand=str(input())
            inputtedList=inputedcommand.split(' ')
            if inputedcommand.count('append')==1:
                inputtedList=inputtedList[1:]
                for i in inputtedList:
                    anslist.append(int(i))
            if inputedcommand.count('insert')==1:
                inputtedList=inputtedList[1:] #Skips the inputed command since 
                position=int(inputtedList[0]) #Gets first number on insert input
                digit=int(inputtedList[1]) #Gets second number on insert input
                anslist.insert(position,digit)
            if inputedcommand.count('print')==1:
                inputtedList=inputtedList[1:]
                print(anslist)
            if inputedcommand.count('remove')==1:
                inputtedList=inputtedList[1:]
                anslist.remove(int(inputtedList[0]))
            if inputedcommand.count('sort')==1:
                inputtedList=inputtedList[1:]
                anslist.sort()
            if inputedcommand.count('pop')==1:
                inputtedList=inputtedList[1:]
                anslist.pop()
            if inputedcommand.count('reverse')==1:
                inputtedList=inputtedList[1:]
                anslist.reverse()