You are viewing a single comment's thread. Return to all comments →
n = int(input()) s = set(map(int, input().split())) n_2 = int(input()) for i in range(n_2): string = input() if "remove" in string or "discard" in string: command, value = string.split() value = int(value) if command == "remove": s.remove(value) elif command == "discard": s.discard(value) else: s.pop() 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 →