[Cater Waiter & Sets Concept]: Better Differentiation of Emoji Examples in Introduction & About Files (#3991)

* Changed emoji examples in indtroduction to be more differentiated.

* Differentiated emoji examples in about.md doc as well.

* Change one more example to differentiate.
This commit is contained in:
BethanyG
2025-09-22 14:16:45 -07:00
committed by GitHub
parent 3297093c98
commit 64ce10de65
2 changed files with 28 additions and 26 deletions

View File

@@ -34,12 +34,13 @@ While sets can be created in many different ways, the most straightforward const
A `set` can be directly entered as a _set literal_ with curly `{}` brackets and commas between elements.
Duplicates are silently omitted:
```python
>>> one_element = {'😀'}
{'😀'}
>>> multiple_elements = {'😀', '😃', '😄', '😁'}
{'😀', '😃', '😄', '😁'}
```python
>>> one_element = {''}
{''}
>>> multiple_elements = {'', '🔻', '🔹', '🔆'}
{'', '🔻', '🔹', '🔆'}
>>> multiple_duplicates = {'Hello!', 'Hello!', 'Hello!',
'¡Hola!','Привіт!', 'こんにちは!',
@@ -108,9 +109,9 @@ Remember: sets can hold different datatypes and _nested_ datatypes, but all `set
```python
# Attempting to use a list for a set member throws a TypeError
>>> lists_as_elements = {['😅','🤣'],
['😂','🙂','🙃'],
['😜', '🤪', '😝']}
>>> lists_as_elements = {['🌈','💦'],
['☁️','⭐️','🌍'],
['⛵️', '🚲', '🚀']}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
@@ -118,9 +119,9 @@ TypeError: unhashable type: 'list'
# Standard sets are mutable, so they cannot be hashed.
>>> sets_as_elements = {{'😅','🤣'},
{'😂','🙂','🙃'},
{'😜', '🤪', '😝'}}
>>> sets_as_elements = {{'🌈','💦'},
{'☁️','⭐️','🌍'},
{'⛵️', '🚲', '🚀'}}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
@@ -131,14 +132,15 @@ However, a `set` of `sets` can be created via type `frozenset()`:
```python
# Frozensets don't have a literal form.
>>> set_1 = frozenset({'😜', '😝', '🤪'})
>>> set_2 = frozenset({'😅', '🤣'})
>>> set_3 = frozenset({'😂', '🙂', '🙃'})
>>> set_1 = frozenset({'🌈','💦'})
>>> set_2 = frozenset({'☁️','⭐️','🌍'})
>>> set_3 = frozenset({'⛵️', '🚲', '🚀'})
>>> frozen_sets_as_elements = {set_1, set_2, set_3}
>>> frozen_sets_as_elements
{frozenset({'😜', '😝', '🤪'}), frozenset({'😅', '🤣'}),
frozenset({'😂', '🙂', '🙃'})}
{frozenset({'⛵️', '🚀', '🚲'}),
frozenset({'🌈', '💦'}),
frozenset({'☁️', '⭐️', '🌍'})}
```

View File

@@ -32,11 +32,11 @@ A `set` can be directly entered as a _set literal_ with curly `{}` brackets and
Duplicates are silently omitted:
```python
>>> one_element = {'😀'}
{'😀'}
>>> one_element = {''}
{''}
>>> multiple_elements = {'😀', '😃', '😄', '😁'}
{'😀', '😃', '😄', '😁'}
>>> multiple_elements = {'', '🔻', '🔹', '🔆'}
{'', '🔻', '🔹', '🔆'}
>>> multiple_duplicates = {'Hello!', 'Hello!', 'Hello!',
'¡Hola!','Привіт!', 'こんにちは!',
@@ -91,9 +91,9 @@ Sets can hold different datatypes and _nested_ datatypes, but all `set` elements
```python
# Attempting to use a list for a set member throws a TypeError
>>> lists_as_elements = {['😅','🤣'],
['😂','🙂','🙃'],
['😜', '🤪', '😝']}
>>> lists_as_elements = {['🌈','💦'],
['☁️','⭐️','🌍'],
['⛵️', '🚲', '🚀']}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
@@ -101,9 +101,9 @@ TypeError: unhashable type: 'list'
# Standard sets are mutable, so they cannot be hashed.
>>> sets_as_elements = {{'😅','🤣'},
{'😂','🙂','🙃'},
{'😜', '🤪', '😝'}}
>>> sets_as_elements = {{'🌈','💦'},
{'☁️','⭐️','🌍'},
{'⛵️', '🚲', '🚀'}}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>