SymPy | Python中的 Subset.next_binary()
Subset.next_binary() :next_binary()是一个 sympy Python库函数,它返回下一个二进制有序子集。
Syntax :
sympy.combinatorics.subset.Subset.next_binary()
Return :
the next binary ordered subset
代码 #1:next_binary() 示例
# Python code explaining
# SymPy.Subset.next_binary()
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
# Using from
# sympy.combinatorics.subset.Subsets.next_binary()
# Creating Subset
a = Subset(['c', 'd'], ['geek', 'for', 'c', 'd'])
# next_binary value
print ("Subset a next_binary : ", a.next_binary().subset)
输出 :
Subset a next_binary : [‘for’]
代码 #2:next_binary() 示例
# Python code explaining
# SymPy.Subset.next_binary()
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
# Using from
# sympy.combinatorics.subset.Subsets.next_binary()
# Creating Subset
a = Subset(['c', 'd'], ['23', 'c', 'd'])
# next_binary value
print ("Subset a next_binary : ", a.next_binary().subset)
输出 :
Subset a next_binary : [’23’]