Skip to content

Commit

Permalink
Solve py set discard remove pop
Browse files Browse the repository at this point in the history
  • Loading branch information
Rootul Patel committed Apr 12, 2020
1 parent 130df39 commit 98bd10c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions python/py-set-discard-remove-pop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
num_elements = int(input())
s = set(map(int, input().split()))
num_operations = int(input())
for _ in range(num_operations):
operation = input().split(" ")
if(operation[0] == "pop"):
s.pop()
else:
op, val = operation
s.discard(int(val))

print(sum(s))

0 comments on commit 98bd10c

Please sign in to comment.