SymPy | Python中的 Subset.rank_binary()
Subset.rank_binary() : rank_binary()是一个返回二进制排序等级的 sympy Python库函数。
Syntax :
sympy.combinatorics.subset.Subset.rank_binary()
Return :
the binary ordered rank.
代码 #1:rank_binary() 示例
# Python code explaining
# SymPy.Subset.rank_binary()
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
# Using from
# sympy.combinatorics.subset.Subsets.rank_binary()
# Creating Subset
a = Subset(['c', 'd'], ['geek', 'for', 'c', 'd'])
# rank_binary value
print ("Subset a rank_binary : ", a.rank_binary)
输出 :
Subset a rank_binary : 3
代码 #2:rank_binary() 示例
# Python code explaining
# SymPy.Subset.rank_binary()
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
# Using from
# sympy.combinatorics.subset.Subsets.rank_binary()
# Creating Subset
a = Subset([2, 3, 4], [1, 2, 3, 4, 5])
# rank_binary value
print ("Subset a rank_binary : ", a.rank_binary)
输出 :
Subset a rank_binary : 14