Tuesday, November 19, 2024
Google search engine
HomeLanguagesSymPy | Subset.prev_lexicographic() in Python

SymPy | Subset.prev_lexicographic() in Python

Subset.prev_lexicographic() : prev_lexicographic() is a sympy Python library function that returns the previous lexicographically ordered subset.

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

Return :
the previous Gray code ordered subset.

Code #1 : prev_lexicographic() Example




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


Output :

Subset a prev_lexicographic : [‘c’]

Code #2 : prev_lexicographic() Example




# Python code explaining
# SymPy.Subset.prev_lexicographic()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
  
# Using from 
# sympy.combinatorics.subset.Subsets.prev_lexicographic()
  
# Creating Subset
a = Subset([2, 3, 4], [1, 2, 3, 4, 5])
  
# prev_lexicographic value
print ("Subset a prev_lexicographic : ", a.prev_lexicographic().subset)


Output :

Subset a prev_lexicographic : [2, 3]

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