Set .discard(), .remove() & .pop()

  • + 2 comments

    Yet, if I use the other format method...

    n = input()
    s = set(map(int, raw_input().split())) 
    
    for _ in range(int(input())):
        x = list(raw_input().split())
        eval('s.{0}({1})'.format(*x+['']))
    print sum(s)
    

    ...it's bulletproof. Poop.