Subset.prev_gray() : prev_gray() is a sympy Python library function that returns the previous Gray code ordered subset.
Syntax :
sympy.combinatorics.subset.Subset.prev_gray()Return :
the previous Gray code ordered subset.
Code #1 : prev_gray() Example
# Python code explaining # SymPy.Subset.prev_gray() # importing SymPy libraries from sympy.combinatorics import Permutation, Cycle from sympy.combinatorics.subsets import Subset # Using from # sympy.combinatorics.subset.Subsets.prev_gray() # Creating Subset a = Subset([ 'c' , 'd' ], [ 'geek' , 'for' , 'c' , 'd' ]) # prev_gray value print ( "Subset a prev_gray : " , a.prev_gray().subset) |
Output :
Subset a prev_gray : [‘d’]
Code #2 : prev_gray() Example
# Python code explaining # SymPy.Subset.prev_gray() # importing SymPy libraries from sympy.combinatorics import Permutation, Cycle from sympy.combinatorics.subsets import Subset # Using from # sympy.combinatorics.subset.Subsets.prev_gray() # Creating Subset a = Subset([ 2 , 3 , 4 ], [ 1 , 2 , 3 , 4 , 5 ]) # prev_gray value print ( "Subset a prev_gray : " , a.prev_gray().subset) |
Output :
Subset a prev_gray : [2, 3, 4, 5]