Saturday, November 16, 2024
Google search engine
HomeLanguagesSymPy | Subset.next_gray() in Python

SymPy | Subset.next_gray() in Python

Subset.next_gray() : next_gray() is a sympy Python library function that returns the next Gray code ordered subset.

Syntax :
sympy.combinatorics.subset.Subset.next_gray()

Return :
the next Gray code ordered subset

Code #1 : next_gray() Example




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


Output :

Subset a next_gray : [‘c’]

Code #2 : next_gray() Example




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


Output :

Subset a next_gray : [‘k’]

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments