Created
August 13, 2022 12:19
-
-
Save CodeDrome/3ed9982fb30d1e6325ac1ffbff92455d to your computer and use it in GitHub Desktop.
setutilities.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from types import MappingProxyType | |
symbols = MappingProxyType({ "emptySet": "∅", | |
"union": "∪", | |
"intersection": "∩", | |
"is_element_of": "∈", | |
"is_not_element_of": "∉", | |
"is_subset_of": "⊆", | |
"is_proper_subset_of": "⊂", | |
"is_not_subset_of": "⊄", | |
"is_superset_of": "⊇", | |
"is_proper_superset_of": "⊃", | |
"is_not_superset_of": "⊅", | |
"natural_numbers": "ℕ", | |
"integers": "ℤ", | |
"rational_numbers": "ℚ", | |
"real_numbers": "ℝ", | |
"complex_numbers": "ℂ", | |
"power_set": "ℙ", | |
"universal_set": "ξ", | |
# this is minuscule Greek letter xi | |
# minuscule zeta ζ. V, U or S are also used. | |
"cartesian_product": "×", | |
"set_difference": "\\", | |
"symmetric_difference": "", | |
"cardinality": "|", | |
"complement": "'",}) | |
def cardinality_string(set, setname): | |
result = f"{symbols['cardinality']}{setname}{symbols['cardinality']} = {len(set)}" | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment