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

  • + 0 comments

    my code is giving correct ouput. i have checked same sinario in spyder and vs code. there it is working fine. but here i am getting run time issue. i think there is issue from intrepreter of hackerrank.please check.

    this is my code: n=input() number=input() s=set(int(x) for x in number.split()) num=int(input()) for i in range(num): a=list(input().split()) if "pop"in a: s.pop() if "discard" in a: s.discard(int(a[1])) if "remove" in a: s.remove(int(a[1])) print(sum(s))