This package contains implementation of the library "PySortedSet". PySortedSet is a data type supporting a sorted set which is aware of indices.
Project description
PySortedSet
PySortedSet is a data type supporting a sorted set which is aware of indices.
Installation
pip install PySortedSet
Usage
To use the library install it using the command shown in "Installation" section. Then, read the instructions below regarding how to use operations with Apfloat.
Length
'len()' function can be called with a PySortedSet as the parameter. It gets the number of elements in the PySortedSet.
Input: len(PySortedSet([1, 4, 5])) Output: 3
Contains
Input: 5 in PySortedSet([5, 6, 2]) Output: True
Union
Input: PySortedSet([5, 6, 2]) + PySortedSet([5, 3]) Output: PySortedSet([2, 3, 5, 6])
Intersection
Input: PySortedSet([5, 6, 2]) & PySortedSet([5, 3]) Output: PySortedSet([5])
Difference
Input: PySortedSet([5, 6, 2]) - PySortedSet([5, 3]) Output: PySortedSet([6, 2])
Get Element at Index
Input:
a: PySortedSet = PySortedSet([5, 6, 2]) print(a[2])
Output: 6
Set Element at Index
Input:
a: PySortedSet = PySortedSet([5, 6, 2]) a[2] = 1 print(a)
Output: {1, 2, 5}
Add Element
Input:
a: PySortedSet = PySortedSet([5, 6, 2]) a.add(1) print(a)
Output: {1, 2, 5, 6}
Remove Element
Input:
a: PySortedSet = PySortedSet([5, 6, 2]) a.remove(5) print(a)
Output: {2, 6}
Pop Element
a: PySortedSet = PySortedSet([5, 6, 2]) a.pop(0) print(a)
Output: {5, 6}
Checking for Equality
Input: PySortedSet([5, 6, 2]) == {2, 5, 6} Output: True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file PySortedSet-1.2.tar.gz
.
File metadata
- Download URL: PySortedSet-1.2.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d76722d9d63e98da978234a6c27b59d4cc474827a2014994ca912f5fb3735b31 |
|
MD5 | 1713c46b1fc2810de635ae3461de6fca |
|
BLAKE2b-256 | 763d1233b868b950b58e0c6abf4f7a71a0245524459a01487bdaa11810dcdc8e |
File details
Details for the file PySortedSet-1.2-py2-none-any.whl
.
File metadata
- Download URL: PySortedSet-1.2-py2-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53d64359f95884bea457337d3b5e39a1d017ba4b9f09e5e4f070843124a32990 |
|
MD5 | 5819c94fe2e24ca0b66c30bcf3e125eb |
|
BLAKE2b-256 | 1f2acbdf211fa906f011b4a3b917edb514b4022a6d9175d998b00b21349b0725 |