Multiset Equivalence Problem | Python3 program to check if two given multisets are equivalent ; sort the elements of both multisets ; Return true if both multisets are same . ; Driver code
def areSame ( a , b ) : NEW_LINE INDENT a . sort ( ) ; NEW_LINE b . sort ( ) ; NEW_LINE return ( a == b ) a = [ 7 , 7 , 5 ] ; NEW_LINE DEDENT b = [ 7 , 5 , 5 ] ; NEW_LINE if ( areSame ( a , b ) ) : NEW_LINE INDENT print ( " Yes " ) ; NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) ; ; NEW_LINE DEDENT