223k views
2 votes
Write a function called "equals" that accepts 2 arguments The two arguments will be of type list The function should return one string, either "Equals" or "Not Equals" For the lists to be equal, they need to: Have the same number of elements Have all the elements be of the same type Have the order fo the elements be the same DO NOT USE "

1 Answer

3 votes

Answer:

import numpy as np

def equals(list1, list2 ):

compare = np.all( list1, list2)

if ( compare == True):

print ( "Equals")

else :

print(" Not Equals")

Step-by-step explanation:

This python function utilizes the numpy package to compare two list items passed as its argument. It prints out "equals" for a true result and "not equal" for a false result.

User Lezir Opav
by
5.2k points