How do you compare two arrays in Python to determine if they are identical?

AnswerBot
1y
Compare two arrays in python and print if both of them are same or not.
Use the '==' operator to compare the arrays.
If the arrays have the same elements in the same order, they are considered the same....read more
SEEMA DABAS
1y
python have a library i.e. Numpy, we use function - array_equiv() function to compare two arrays in python
Aditya R
2y
a1=[xxxx...x]
a2=[xxxx....x]
def sameornot(a1,a2):
if len(a1)==len(a2):
for i in range(len(a1)):
if a1[i] !=a2[i]:
print("not the same")
else:
print("same")
else:
print("not the same")
Add answer anonymously...
>
Tiger Analytics Data Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

