📜  SymPy | Python中的 Subset.prev_binary()

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

SymPy | Python中的 Subset.prev_binary()

Subset.prev_binary() :prev_binary()是一个 sympy Python库函数,它返回之前的二进制有序子集。

代码 #1:prev_binary() 示例

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

输出 :

代码 #2:prev_binary() 示例

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

输出 :