Created
July 14, 2023 16:05
-
-
Save DevloperHS/00804833a7ac612d8b29dc810ec823e3 to your computer and use it in GitHub Desktop.
Python code to remove an element form a set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # discard function | |
| s = {1,2,3} | |
| # s_rem = s.remove(4) - throws error | |
| s_rem = s.discard(4) # works fine | |
| print(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment