Compare two arrays in python and print if both of them are same or not?

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
1y

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
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

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

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter