You are viewing a single comment's thread. Return to all comments →
for noobs like me, who do not care about chatgpt or time complexities
if name == 'main': N = int(input())
lis = [] for _ in range(N): ip = input().split(" ") j = ip[0]
if ip[0] == "insert": lis.insert(int(ip[1]), int(ip[2])) elif ip[0] == "print": print(lis) elif ip[0] == "remove": lis.remove(int(ip[1])) elif j == "append": lis.append(int(ip[1])) elif j == "sort": lis.sort() elif j == "pop": lis.pop(-1) elif j == "reverse": lis.reverse() else: print("Invalid")
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 →
for noobs like me, who do not care about chatgpt or time complexities
if name == 'main': N = int(input())
lis = [] for _ in range(N): ip = input().split(" ") j = ip[0]