About 9,270,000 results
Open links in new tab
  1. python - Understanding the set () function - Stack Overflow

    Mar 3, 2013 · Internally, the set type is implemented using a hash table: a hash function is used to separate items into a number of buckets to reduce the number of equality operations needed …

  2. Append values to a set in Python - Stack Overflow

    Aug 2, 2010 · I find it out that to add either a single value or multiple values to a set you have to use the set.add () function. It is the most efficient method among the others.

  3. Use curly braces to initialize a Set in Python - Stack Overflow

    Curly braces or the set () function can be used to create sets. Note: to create an empty set you have to use set (), not {}; the latter creates an empty dictionary, a data structure that we …

  4. Python's "in" set operator - Stack Overflow

    Jan 2, 2012 · I'm a little confused about the python in operator for sets. If I have a set s and some instance b, is it true that b in s means "is there some element x in s such that b == x is true"?

  5. How can I change the Python version in Visual Studio Code?

    Jan 7, 2018 · If you selected python 3.6 in Visual Studio Code > View > Command Palette (CTRL+SHIFT+P) > Python: Select Interpreter, the play (execute) button will begin the call …

  6. How to construct a set out of list items in python?

    285 I have a list of filenames in python and I would want to construct a set out of all the filenames.

  7. python - How do I add two sets? - Stack Overflow

    Apr 15, 2015 · Python doesn't use + for set union because it's sort of ambiguous. Set union and set intersection could both be thought of as two different strategies for "adding" sets -- so by …

  8. python - Add list to set - Stack Overflow

    Aug 20, 2009 · Set elements as well as dictionary keys have to be hashable Some unhashable datatypes: list: use tuple instead set: use frozenset instead dict: has no official counterpart, but …

  9. python - How to retrieve an element from a set without removing …

    Learn how to retrieve an element from a Python set without removing it, with detailed solutions and examples provided by the Stack Overflow community.

  10. In Python, when to use a Dictionary, List or Set?

    Jul 1, 2019 · When should I use a dictionary, list or set? Are there scenarios that are more suited for each data type?