SymPy | Python中的 Subset.prev_binary()
Subset.prev_binary() :prev_binary()是一个 sympy Python库函数,它返回之前的二进制有序子集。
Syntax :
sympy.combinatorics.subset.Subset.prev_binary()
Return :
the previous binary ordered subset.
代码 #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)
输出 :
Subset a prev_binary : [‘c’]
代码 #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)
输出 :
Subset a prev_binary : [‘k’]