Skip to content

Instantly share code, notes, and snippets.

@andeoliveira
Created March 21, 2021 23:16
Show Gist options
  • Save andeoliveira/4779bf6eb55abbb1c92e83f187328d39 to your computer and use it in GitHub Desktop.
Save andeoliveira/4779bf6eb55abbb1c92e83f187328d39 to your computer and use it in GitHub Desktop.
Remover item do set com remove e discard
#Remover um item do Set Python com remove()
bandas_rock_alternativo = {"Red Hot Chili Peppers", "Muse", "The Killers"}
bandas_rock_alternativo.remove("Muse") #Remove o item pelo próprio objeto
print(bandas_rock_alternativo) #{'Red Hot Chili Peppers', 'The Killers'}
#Remover um item do Set Python com discard()
bandas_rock_alternativo = {"Red Hot Chili Peppers", "Muse", "The Killers"}
bandas_rock_alternativo.discard("Muse") #Remove o item pelo próprio objeto
print(bandas_rock_alternativo) #{'Red Hot Chili Peppers', 'The Killers'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment