We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
N = int(input())
l = []
def performOperation(cmdList):
match cmdList[0]:
case 'insert': l.insert(int(cmdList[1]),int(cmdList[2]))
case 'append': l.append(int(cmdList[1]))
case 'remove': l.remove(int(cmdList[1]))
case 'sort': l.sort()
case 'pop': l.pop()
case 'reverse': l.reverse()
case 'print': print(l)
case _: return
for i in range(N):
cmd = input()
performOperation(cmd.split(" "))
Cookie support is required to access HackerRank
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 →