Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:46:22+00:00 2026-06-05T01:46:22+00:00

In the below shown matrices i want to match the first element in both

  • 0

In the below shown matrices i want to match the first element in both the matrices. If the first element is equal then i need match the second element from both the matrices and so on..
if the elements are same then print “same” else print “not same”….

My question is how this in the optimal way also for m*n where m=n always

 for i in a1:
     for j in a2:
        if i!=j:
           break
         else:
           //compare the next corresponding columns and print "same" or "not same"


 a1=[1,44,55],[2,33,66],[3,77,91]  

 a2=[1,44,55],[2,45,66],[3,77,91]    

 OR 

 a1=[1,44,55]
    [2,33,66]
    [3,77,91]  

 a2=[1,44,55]
    [2,45,66]
    [3,77,91]  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:46:24+00:00Added an answer on June 5, 2026 at 1:46 am

    What’s wrong with a1 == a2?

    In [1]: a1=[[1,44,55],
       ...:     [2,33,66],
       ...:     [3,77,91]]
    
    In [2]: a2=[[1,44,55],
       ...:     [2,45,66], # <- second element differs
       ...:     [3,77,91]]
    
    In [3]: a1 == a2
    Out[3]: False
    
    In [4]: a1=[[1,44,55],
       ...:     [2,33,66],
       ...:     [3,77,91]]
    
    In [5]: a2=[[1,44,55],
       ...:     [2,33,66],
       ...:     [3,77,91]]
    
    In [6]: a1 == a2
    Out[6]: True
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The below shown is my query I need to order by with these three
In the code shown below, I need to manipulate the time var in python
I have the script shown below that displays a list of records from a
I have the models shown below. I need to store some details that are
as shown below, if the user hover over the div then how to halt
I declared an array as shown below: int[] arr = new int[10]; Then I
I have a sql query shown below i want to use the variables streetname,
In the below shown dictionaries i want to check whether the key in aa
As shown below the Table Recording contains three foreign keys, only one of which
In the code shown below, how to get the values of multiselect box in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.