📜  SymPy | Python中的 Subset.superset()

📅  最后修改于: 2022-05-13 01:54:18.482000             🧑  作者: Mango

SymPy | Python中的 Subset.superset()

Subset.superset() : superset()是一个 sympy Python库函数,它返回子集的超集。

代码 #1:superset() 示例

# Python code explaining
# SymPy.Subset.superset()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
  
# Using from 
# sympy.combinatorics.subset.Subsets.superset()
  
# Creating Subset
a = Subset(['c', 'd'], ['geek', 'for', 'c', 'd'])
  
# superset value
print ("Subset a superset : ", a.superset)

输出 :

代码 #2:superset() 示例

# Python code explaining
# SymPy.Subset.superset()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
  
# Using from 
# sympy.combinatorics.subset.Subsets.superset()
  
# Creating Subset
a = Subset([2, 3, 4], [1, 2, 3, 4, 5])
  
# superset value
print ("Subset a superset : ", a.superset)

输出 :