📜  SymPy | Python中的 Subset.subset_from_bitlist()

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

SymPy | Python中的 Subset.subset_from_bitlist()

Subset.subset_from_bitlist() :subset_from_bitlist()是一个 sympy Python库函数,它返回位列表定义的子集。

代码 #1:subset_from_bitlist() 示例

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

输出 :

代码 #2:subset_from_bitlist() 示例

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

输出 :