Last active
February 16, 2020 18:43
-
-
Save pars3c/0e21e2023d208236865478629a322fd7 to your computer and use it in GitHub Desktop.
How do sets work in Python
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
# Declare the set | |
my_set = {1, 2, 3, 4, 4} | |
print(my_set) | |
# Will output {1, 2, 3, 4} | |
# FUN NOTE: strings can also be added to sets in Python like {"Banana", "apple"}, | |
# keep in mind it will still forbid repetition |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment