You are viewing a single comment's thread. Return to all comments →
N=int(input()) mylist = [] for i in range(N): command = input().split()
if command[0] == "insert": mylist.insert(int(command[1]), int(command[2])) elif command[0] == "print": print(mylist) elif command[0] == "remove": mylist.remove(int(command[1])) elif command[0] == "append": mylist.append(int(command[1])) elif command[0] == "sort": mylist.sort() elif command[0] == "pop": mylist.pop() elif command[0] == "reverse": mylist.reverse()
Seems like cookies are disabled on this browser, please enable them to open this website
Lists
You are viewing a single comment's thread. Return to all comments →
N=int(input()) mylist = [] for i in range(N): command = input().split()