# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Deep Equals
#
# Write a function that determines if two lists of numbers are equal

a = [1, 2, 3]
b = [1, 2, 3]
c = [1, 2, 3, 4]
d = [3, 2, 1]
e = [1, 1, 2, 3]

# +
# printing lists 
print ("The first list is : " + str(a)) 
print ("The second list is : " + str(b)) 
print ("The third list is : " + str(c)) 
print ("The fourth list is : " + str(d))
print ("The fifth list is : " + str(e)) 
 
 
# sorting both the lists 
a.sort()
b.sort()
c.sort()
d.sort()
e.sort()


# using == to check if  
# lists are equal 
if a == b == c == d == e: 
    print ("All the lists are identical") 
elif a == b == c: 
    print ("The first list is identical to the second and third")
elif a == b == d: 
    print ("The first list is identical to the second and fourth")
elif a == b == e: 
    print ("The first list is identical to the second and fifth")
elif a == b: 
    print ("The first list is identical to the second")
elif a == c: 
    print ("The first list is identical to the third") 
elif a == d: 
    print ("The first list is identical to the fourth")
elif a == e: 
    print ("The first list is identical to fifth") 

# +
# Python 3 code to demonstrate  
# check if list are identical 
# using collections.Counter() 
import collections 
  
# initializing lists  
a = [1, 2, 3]
b = [1, 2, 3]
c = [1, 2, 3, 4]
d = [3, 2, 1]
e = [1, 1, 2, 3]
  
# printing lists 
print ("The first list is : " + str(a)) 
print ("The second list is : " + str(b))
print ("The first list is : " + str(c)) 
print ("The second list is : " + str(d)) 
print ("The second list is : " + str(e)) 
  
# using collections.Counter() to check if  
# lists are equal 
if collections.Counter(a) == collections.Counter(b)== collections.Counter(c)== collections.Counter(d)== collections.Counter(e): 
    print ("The lists are identical") 

elif collections.Counter(a) == collections.Counter(b):
    print ("The First list is identical to second") 
else : 
    print ("The lists are not identical") 
# -



StarcoderdataJupyterScriptsDedupFiltered