adplus-dvertising
frame-decoration

Question

The difference between the functions discard and remove is that:

a.

Discard removes the last element of the set whereas remove removes the first element of the set

b.

Discard throws an error if the specified element is not present in the set whereas remove does not throw an error in case of absence of the specified element

c.

Remove removes the last element of the set whereas discard removes the first element of the set

d.

Remove throws an error if the specified element is not present in the set whereas discard does not throw an error in case of absence of the specified element

Posted under Tuples and Sets Python

Answer: (d).Remove throws an error if the specified element is not present in the set whereas discard does not throw an error in case of absence of the specified element

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. The difference between the functions discard and remove is that: