Subset.iterate_graycode() : iterate_graycode() is a sympy Python library function that iterates over the k steps to get the respective Gray codes.
Syntax :
sympy.combinatorics.subset.Subset.iterate_graycode()
Return :
iterates over the k steps to get the respective Gray codes
Code #1 : iterate_graycode() Example
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
a = Subset([ 'c' , 'd' ], [ 'geek' , 'for' , 'c' , 'd' ])
print ( "Subset a iterate_graycode : " , a.iterate_graycode( 1 ).subset)
|
Output :
Subset a iterate_graycode : [‘c’]
Code #2 : iterate_graycode() Example
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
a = Subset([ 'c' , 'd' ], [ '23' , 'c' , 'd' ])
print ( "Subset a iterate_graycode : " , a.iterate_graycode( 3 ).subset)
|
Output :
Subset a iterate_graycode : [’23’, ‘c’, ‘d’]
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
26 Aug, 2019
Like Article
Save Article