Skip to content

Instantly share code, notes, and snippets.

@DevloperHS
Created July 14, 2023 16:05
Show Gist options
  • Select an option

  • Save DevloperHS/00804833a7ac612d8b29dc810ec823e3 to your computer and use it in GitHub Desktop.

Select an option

Save DevloperHS/00804833a7ac612d8b29dc810ec823e3 to your computer and use it in GitHub Desktop.
Python code to remove an element form a set
# 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