You are viewing a single comment's thread. Return to all comments →
if name == 'main': N = int(input()) lst = []
for _ in range(N): command = input().split() cmd = command[0] if cmd == "insert": index, value = int(command[1]), int(command[2]) lst.insert(index, value) elif cmd == "print": print(lst) elif cmd == "remove": value = int(command[1]) lst.remove(value) elif cmd == "append": value = int(command[1]) lst.append(value) elif cmd == "sort": lst.sort() elif cmd == "pop": lst.pop() elif cmd == "reverse": lst.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 →
if name == 'main': N = int(input()) lst = []