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