Skip to content

Instantly share code, notes, and snippets.

@pars3c
Last active February 16, 2020 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pars3c/0e21e2023d208236865478629a322fd7 to your computer and use it in GitHub Desktop.
Save pars3c/0e21e2023d208236865478629a322fd7 to your computer and use it in GitHub Desktop.
How do sets work in Python
# 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