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