Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

SymPy | Subset.prev_binary() in Python

  • Last Updated : 28 Aug, 2019

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

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

Return :
the previous binary ordered subset.

Code #1 : prev_binary() Example




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

Output :

Subset a prev_binary : [‘c’]

Code #2 : prev_binary() Example




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

Output :

Subset a prev_binary : [‘k’]


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!