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")

Select
Add answer anonymously...
Tiger Analytics Data Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits