I have a code for discard and remove function in Python 3. Can anyone explain the difference?
remove() function :
num_set = set([0, 1, 2, 3, 4, 5])
num_set.remove(0)
print(num_set)
o/p
{1, 2, 3, 4, 5}
discard() function :
num_set = set([0, 1, 2, 3, 4, 5])
num_set.discard(3)
print(num_set)
o/p:
{0, 1, 2, 4, 5}