Overview Discard and Remove both functions remove a specific value from the dictionary. Then the major question is which function should we use and why? It’s better to use the discard function. Suppose you have a set s={‘Apple’,’Elephant’,’orange’} let’s try both functions. 1. s={‘Apple’,’Elephant’,’orange’}
s.remove('Elephant')
print(s) [out]>> {'Apple','orange'} 2. s={‘Apple’,’Elephant’,’orange’}…