Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Outline

Sets

  • Unordered Collection
  • Mutable
  • Iterable
  • No Duplicate Vals

Declaring A Set

myset={"Bye", "Hi", "In A While"}
myset1 = {"a","c","c","d"}

myset2={"f","c", "j"}
Start Method Output
add {"hi","how","are","you"} .add("great") you, how, hi, great, are
clear {"▢","☆"} .clear() {}
copy a set {"△","▢","☆"} .copy() NEW COPY IS MADE
difference {"a","c","c","d"} .difference(myset2) j, f
discard {"△","▢","☆"} .discard("△") ☆,▢
pop i.e. removes from top {"△","▢","☆"} .pop() ▢,☆
remove {"▢","☆","△"} .remove("☆") ▢,△
union {"a","c","c","d"} .union(myset2) c,a,f,d,j

Operators

Operator Meaning
== all keys and values in the set1 are equal in set2
!= set1 is not equal to set2
<= set1 is a subset of set2
>= set1 is a superset of set2
| union of set1 and set2
& intersecting point of set1 and set2
- items that are present in set1 but not in set 2
^ items that are stricly either in set1 or in set2 (i.e. !both )
Morty Proxy This is a proxified and sanitized view of the page, visit original site.