• + 0 comments

    length_of_list=int(input()) list_of_commands=[] final_list=[] for i in range(length_of_list): list_of_commands=list(input().split(" ")) if list_of_commands[0]=="insert": final_list.insert(int(list_of_commands[1]),int(list_of_commands[2])) elif list_of_commands[0]=="print": print(final_list) elif list_of_commands[0]=="remove": final_list.remove(int(list_of_commands[1])) elif list_of_commands[0]=="append": final_list.append(int(list_of_commands[1])) elif list_of_commands[0]=="sort": final_list.sort() elif list_of_commands[0]=="pop": final_list.pop() elif list_of_commands[0]=="reverse": final_list.reverse() else: pass