Skip to content

Commit 1a61e47

Browse files
geetxnshgoyalmajestic-owl448Dario-DC
authored
fix(curriculum): correct symmetric difference wording and examples (freeCodeCamp#64512)
Co-authored-by: Ilenia M <[email protected]> Co-authored-by: Dario <[email protected]>
1 parent 75f3021 commit 1a61e47

File tree

4 files changed

+39
-9
lines changed

4 files changed

+39
-9
lines changed

curriculum/challenges/english/blocks/lecture-working-with-dictionaries-and-sets/683ec8fd8b21827317388a45.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The difference operator `-` returns a new set with the elements of the first set
103103
my_set - your_set # {1, 5}
104104
```
105105

106-
The symmetric difference operator `^` returns a new set with the elements that are either on the first or the second set, but not both. In this case, 1 and 5 are in `my_set` but not in `your_set`, so they are included. And the number 6 is in `your_set` but not in `my_set`, so it's included as well:
106+
The symmetric difference operator `^` returns a new set with the elements that are either in the first or the second set, but not both. In this case, 1 and 5 are in `my_set` but not in `your_set`, so they are included. And the number 6 is in `your_set` but not in `my_set`, so it's included as well:
107107

108108
```python
109109
my_set ^ your_set # {1, 5, 6}

curriculum/challenges/english/blocks/quiz-dictionaries-and-sets/67f412ac59601c4151b763da.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ It returns a new set with the elements of the first set that are not in the othe
466466

467467
#### --answer--
468468

469-
It returns a new set with the elements that are either on the first or the second set, but not both.
469+
It returns a new set with the elements that are either in the first or the second set, but not both.
470470

471471
### --question--
472472

curriculum/challenges/english/blocks/review-dictionaries-and-sets/67f39babe1e2ec1fb6eea32a.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ my_set.clear()
241241
- **`issubset()` and `issuperset()` Methods**: The `issubset()` and the `issuperset()` methods check if a set is a subset or superset of another set, respectively.
242242

243243
```python
244-
my_set = {1, 2, 3, 4, 5}
244+
my_set = {1, 2, 3, 4, 5}
245245
your_set = {2, 3, 4, 5}
246246

247247
print(your_set.issubset(my_set)) # True
@@ -251,37 +251,52 @@ print(my_set.issuperset(your_set)) # True
251251
- **`isdisjoint()` Method**: The `isdisjoint()` method checks if two sets are disjoint, if they don't have elements in common.
252252

253253
```python
254-
print(my_set.isdisjoint(your_set)) # False
254+
my_set = {1, 2, 3}
255+
your_set = {4, 5, 6}
256+
257+
print(my_set.isdisjoint(your_set)) # True
255258
```
256259

257260
- **Union Operator (`|`)**: The union operator `|` returns a new set with all the elements from both sets.
258261

259262
```python
263+
my_set = {1, 2, 3}
264+
your_set = {4, 5, 6}
265+
260266
my_set | your_set # {1, 2, 3, 4, 5, 6}
261267
```
262268

263269
- **Intersection Operator (`&`)**: The intersection operator `&` returns a new set with only the elements that the sets have in common.
264270

265271
```python
272+
my_set = {1, 2, 3, 4, 5}
273+
your_set = {2, 3, 4, 6}
274+
266275
my_set & your_set # {2, 3, 4}
267276
```
268277

269278
- **Difference Operator (`-`)**: The difference operator `-` returns a new set with the elements of the first set that are not in the other sets.
270279

271280
```python
281+
my_set = {1, 2, 3, 4, 5}
282+
your_set = {2, 3, 4, 6}
283+
272284
my_set - your_set # {1, 5}
273285
```
274286

275-
- **Symmetric Difference Operator (`^`)**: The symmetric difference operator `^` returns a new set with the elements that are either on the first or the second set, but not both.
287+
- **Symmetric Difference Operator (`^`)**: The symmetric difference operator `^` returns a new set with the elements that are either in the first or the second set, but not both.
276288

277289
```python
290+
my_set = {1, 2, 3, 4, 5}
291+
your_set = {2, 3, 4, 6}
292+
278293
my_set ^ your_set # {1, 5, 6}
279294
```
280295

281296
- **`in` Operator**: You can check if an element is in a set or not with the `in` operator.
282297

283298
```python
284-
print(5 in my_set)
299+
print(5 in my_set) # True
285300
```
286301

287302
## Python Standard Library

curriculum/challenges/english/blocks/review-python/67f39e391c9b373069def02c.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,7 @@ my_set.clear()
18071807
- **`issubset()` and `issuperset()` Methods**: The `issubset()` and the `issuperset()` methods check if a set is a subset or superset of another set, respectively.
18081808

18091809
```python
1810-
my_set = {1, 2, 3, 4, 5}
1810+
my_set = {1, 2, 3, 4, 5}
18111811
your_set = {2, 3, 4, 5}
18121812

18131813
print(your_set.issubset(my_set)) # True
@@ -1817,30 +1817,45 @@ print(my_set.issuperset(your_set)) # True
18171817
- **`isdisjoint()` Method**: The `isdisjoint()` method checks if two sets are disjoint, if they don't have elements in common.
18181818

18191819
```python
1820-
print(my_set.isdisjoint(your_set)) # False
1820+
my_set = {1, 2, 3}
1821+
your_set = {4, 5, 6}
1822+
1823+
print(my_set.isdisjoint(your_set)) # True
18211824
```
18221825

18231826
- **Union Operator (`|`)**: The union operator `|` returns a new set with all the elements from both sets.
18241827

18251828
```python
1829+
my_set = {1, 2, 3}
1830+
your_set = {4, 5, 6}
1831+
18261832
my_set | your_set # {1, 2, 3, 4, 5, 6}
18271833
```
18281834

18291835
- **Intersection Operator (`&`)**: The intersection operator `&` returns a new set with only the elements that the sets have in common.
18301836

18311837
```python
1838+
my_set = {1, 2, 3, 4, 5}
1839+
your_set = {2, 3, 4, 6}
1840+
18321841
my_set & your_set # {2, 3, 4}
18331842
```
18341843

18351844
- **Difference Operator (`-`)**: The difference operator `-` returns a new set with the elements of the first set that are not in the other sets.
18361845

18371846
```python
1847+
my_set = {1, 2, 3, 4, 5}
1848+
your_set = {2, 3, 4, 6}
1849+
18381850
my_set - your_set # {1, 5}
18391851
```
18401852

1841-
- **Symmetric Difference Operator (`^`)**: The symmetric difference operator `^` returns a new set with the elements that are either on the first or the second set, but not both.
1853+
- **Symmetric Difference Operator (`^`)**: The symmetric difference operator `^` returns a new set with the elements that are either in the first or the second set, but not both.
18421854

18431855
```python
1856+
my_set = {1, 2, 3, 4, 5}
1857+
your_set = {2, 3, 4, 6}
1858+
18441859
my_set ^ your_set # {1, 5, 6}
18451860
```
18461861

0 commit comments

Comments
 (0)