Created
March 21, 2021 23:16
-
-
Save andeoliveira/4779bf6eb55abbb1c92e83f187328d39 to your computer and use it in GitHub Desktop.
Remover item do set com remove e discard
This file contains 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
#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