You are viewing a single comment's thread. Return to all comments →
if __name__ == '__main__': N = int(input()) lst = [] for _ in range(N): parts = input().split() cmd = parts[0] args = list(map(int, parts[1:])) # convert remaining parts to integers if cmd == "print": print(lst) else: getattr(lst, cmd)(*args) # *args unpacks the list into separate arguments
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 →