New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Term Entry] Python sets .issubset() #4613 #4634
[Term Entry] Python sets .issubset() #4613 #4634
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @jesacebar! Thank you for Contributing at Codecademy Docs! The entry was well written!
I've added just a few suggestions, could you please review and modify them at your earliest convenience?
Thank you!
--- | ||
Title: ".issubset()" | ||
Description: "Returns True if all elements in a set exist in another; otherwise, it returns False." | ||
Subjects: | ||
- "Code Foundations" | ||
- "Computer Science" | ||
Tags: | ||
- "Collections" | ||
- "Functions" | ||
- "Methods" | ||
- "Sets" | ||
CatalogContent: | ||
- "learn-python-3" | ||
- "paths/computer-science" | ||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--- | |
Title: ".issubset()" | |
Description: "Returns True if all elements in a set exist in another; otherwise, it returns False." | |
Subjects: | |
- "Code Foundations" | |
- "Computer Science" | |
Tags: | |
- "Collections" | |
- "Functions" | |
- "Methods" | |
- "Sets" | |
CatalogContent: | |
- "learn-python-3" | |
- "paths/computer-science" | |
--- | |
--- | |
Title: '.issubset()' | |
Description: 'Returns `True` if all elements in a set exist in another; otherwise, it returns `False`.' | |
Subjects: | |
- 'Code Foundations' | |
- 'Computer Science' | |
Tags: | |
- 'Collections' | |
- 'Methods' | |
- 'Sets' | |
CatalogContent: | |
- 'learn-python-3' | |
- 'paths/computer-science' | |
--- |
- "paths/computer-science" | ||
--- | ||
|
||
The **`issubset()`** method returns True if all of the elements in a set exist within another given set. If all of the elements are not contained within the given set, it will return False instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The **`issubset()`** method returns True if all of the elements in a set exist within another given set. If all of the elements are not contained within the given set, it will return False instead. | |
The **`.issubset()`** method returns `True` if all elements in a set exist within another specified set. If any elements are not contained within the specified set, it returns `False`. |
set_A.issubset(set_B) | ||
|
||
# Alternatively, a shorter syntax version can be used to do the same thing. | ||
set_A <= set_B |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set_A.issubset(set_B) | |
# Alternatively, a shorter syntax version can be used to do the same thing. | |
set_A <= set_B | |
set.issubset(set1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just below the syntax, please describe the parameters like:
set
: Parameter descriptionset1
: Parameter description
print(x.issubset(y)) # True, because y contains all of the elements in x. | ||
print(x.issubset(z)) # False, because z doesn't contain all of the elements in x. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print(x.issubset(y)) # True, because y contains all of the elements in x. | |
print(x.issubset(z)) # False, because z doesn't contain all of the elements in x. | |
print(x.issubset(y)) | |
print(x.issubset(z)) |
print(set_A.issubset(set_B)) | ||
``` | ||
|
||
This would print `True`, because `set_B` contains all of the elements in `set_B`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would print `True`, because `set_B` contains all of the elements in `set_B`: | |
This would print `True`, because `set_B` contains all of the elements in `set_B`. It produces the following output: |
|
||
This would print `True`, because `set_B` contains all of the elements in `set_B`: | ||
|
||
```py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```py | |
```shell |
Hello, @mamtawardhani. Thank you for your suggestions! I believe I have covered all of them with my most recent changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for making the required changes @jesacebar!
Looks good for the next review!👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jesacebar I've requested some changes. Please take a moment to address them. If you have any concerns or reasons to reject specific suggestions, feel free to discuss them.
@@ -0,0 +1,51 @@ | |||
--- | |||
Title: '.issubset()' | |||
Description: 'Returns True if all elements in a set exist in another; otherwise, it returns False.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description: 'Returns True if all elements in a set exist in another; otherwise, it returns False.' | |
Description: 'Checks whether all elements in one set exist within another specified set.' |
- 'paths/computer-science' | ||
--- | ||
|
||
The **`.issubset()`** method returns `True` if all elements in a set exist within another specified set. If any elements are not contained within the specified set, it returns `False`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The **`.issubset()`** method returns `True` if all elements in a set exist within another specified set. If any elements are not contained within the specified set, it returns `False`. | |
The **`.issubset()`** method checks whether all elements in one set exist within another specified set. It returns `True` if this condition is met; otherwise, it returns `False`. |
## Syntax | ||
|
||
```pseudo | ||
set.issubset(set1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set.issubset(set1) | |
set1.issubset(set2) |
- `set`: The set whose elements are being checked for existence within `set1`. | ||
- `set1`: The set being searched for the presence of elements from the `set`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `set`: The set whose elements are being checked for existence within `set1`. | |
- `set1`: The set being searched for the presence of elements from the `set`. | |
- `set1`: The set whose elements are being checked for existence within `set2`. | |
- `set2`: The set being searched for the presence of elements from the `set1`. |
- `set1`: The set being searched for the presence of elements from the `set`. | ||
|
||
## Example | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following example demonstrate the usage of `.issubset()` method: | |
Hello, @letsbuildanything. Thank you for your suggestions as well! I think I covered all of them in the latest changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
👋 @jesacebar 🎉 Your contribution(s) can be seen here: https://www.codecademy.com/resources/docs/python/sets/issubset Please note it may take a little while for changes to become visible. |
* Add Python sets issubset() term entry * Improve some sentences and format in Python issubset() term entry * Update issubset.md * Update issubset.md * Modify descriptions and variable names in issubset() term entry * Improve grammar of sentence in issubset() term entry ---------
Description
Added a term entry that describes the Python set method
issubset()
.Issue Solved
Closes #4613
Type of Change
Checklist
main
branch.Issues Solved
section.