Skip to content

Commit 7c9a218

Browse files
Sets README
1 parent 41ba93a commit 7c9a218

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Sets/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Sets
2+
3+
- Unordered Collection
4+
- Mutable
5+
- Iterable
6+
- No Duplicate Vals
7+
8+
### Declaring A Set
9+
10+
```python
11+
myset={"Bye", "Hi", "In A While"}
12+
myset1 = {"a","c","c","d"}
13+
14+
myset2={"f","c", "j"}
15+
```
16+
17+
18+
19+
| |Start | Method |Output |
20+
|----------------|-----------------|------------|---------------|
21+
|add|{} | {} | .add(▢) |{▢} |
22+
|clear | ▢☆ |.clear() |{} |
23+
|copy a set | △▢☆ |.copy() |▢▢▢ |
24+
|difference | "a","c","c","d" |.difference(myset2) | { "j", "f"} |
25+
|discard | △▢☆ |.discard("△") | {"▢", "☆"} |
26+
|pop i.e. removes from top | △▢☆ |.pop() | {"▢","☆" } |
27+
|remove | ▢☆△ |.remove(☆) |[▢,△ ] |
28+
|union | |.union(myset2) |{"c", "a", "f", "d", "j"} |
29+

0 commit comments

Comments
 (0)