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

SymPy | Subset.iterate_binary() in Python

Subset.iterate_binary() : iterate_binary() is a sympy Python library function that iterates over the binary subsets by k steps. Value of ‘k’ can be positive or negative.

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

Return :
iterates over the binary subsets by k steps

Code #1 : iterate_binary() Example




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


Output :

Subset a iterate_binary : [‘for’]

Code #2 : iterate_binary() Example




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


Output :

Subset a iterate_binary : [’23’, ‘d’]

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