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