You are viewing a single comment's thread. Return to all comments →
n = int(input()) s = set(map(int, input().split())) n1 = int(input()) for i in range(n1): method = input().split() if len(method) == 1 and method[0]=="pop": s.pop() elif method[0] == "remove" : s.remove(int(method[1])) elif method[0] == "discard": s.discard(int(method[1])) print(sum(s))
Seems like cookies are disabled on this browser, please enable them to open this website
Set .discard(), .remove() & .pop()
You are viewing a single comment's thread. Return to all comments →