Registry Mirror
搜索
Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Files
Expand file tree
master
Breadcrumbs
python
/
different.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
11 lines (8 loc) · 411 Bytes
master
Breadcrumbs
python
/
different.py
Copy path
Top
File metadata and controls
Code
Blame
11 lines (8 loc) · 411 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
def how_many_different_numbers(numbers: list[int]) -> int:
"""Return the number of unique numbers in the list."""
unique_numbers = set(numbers)
return len(unique_numbers)
print(how_many_different_numbers([1, 2, 3, 1, 2, 3, 4, 1]))
def different(a: list[int], b: list[int]) -> list[int]:
"""Return a list of elements in a that are not in b."""
return [item for item in a if item not in b]
You can’t perform that action at this time.