Open In App
Related Articles

SymPy | Subset.bitlist_from_subset() in Python

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
Subset.bitlist_from_subset() : bitlist_from_subset() is a sympy Python library function that returns the bit list corresponding to a subset.
Syntax : sympy.combinatorics.subset.Subset.bitlist_from_subset() Return : bitlist corresponding to a subset
Code #1 : bitlist_from_subset() Example
# Python code explaining
# SymPy.Subset.bitlist_from_subset()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
  
# Using from 
# sympy.combinatorics.subset.Subsets.bitlist_from_subset()
  
# Creating Subset
a = Subset.bitlist_from_subset(['c', 'd'], ['geek', 'for', 'c', 'd'])
  
# bitlist_from_subset value
print ("Subset a bitlist_from_subset : ", a)

                    
Output :
Subset a bitlist_from_subset : 0011
Code #2 : bitlist_from_subset() Example
# Python code explaining
# SymPy.Subset.bitlist_from_subset()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
  
# Using from 
# sympy.combinatorics.subset.Subsets.bitlist_from_subset()
  
# Creating Subset
a = Subset.bitlist_from_subset(['1', '2'], ['4', '3', 'c', 'd'])
  
# bitlist_from_subset value
print ("Subset a bitlist_from_subset : ", a)

                    
Output :
Subset a bitlist_from_subset : 0000


Last Updated : 26 Aug, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads