xxxxxxxxxx
# function to check both lists if they are equal
def checkList(firstlist, secondlist):
# sorting the lists
firstlist.sort()
secondlist.sort()
# if both the lists are equal the print yes
if(firstlist == secondlist):
print("Both lists are equal")
else:
print("Both lists are not equal")
# Driver code
# given two lists
firstlist = ['hello', 'this', 'is', 'BTechGeeks']
secondlist = ['this', 'is', 'BTechGeeks','hello']
# passing both the lists to checklist function
checkList(firstlist, secondlist)
xxxxxxxxxx
a = [4,7,3,5,8]
b = [4,7,3,5,8]
c = [1,7,3,5,2]
print(a == b)
print(a == c)
xxxxxxxxxx
a = [4,7,3,5,8]
b = [4,7,3,5,8]
c = [1,7,3,5,2]
print(a == b)
print(a == c)
Output:
True
False