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 8835069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:10:30+00:00 2026-06-14T09:10:30+00:00

The native python codes are like this: >>> a=[1,2,3,4,5,6] >>> [[i+j for i in

  • 0

The native python codes are like this:

>>> a=[1,2,3,4,5,6]
>>> [[i+j for i in a] for j in a]
[[2, 3, 4, 5, 6, 7], 
 [3, 4, 5, 6, 7, 8], 
 [4, 5, 6, 7, 8, 9], 
 [5, 6, 7, 8, 9, 10], 
 [6, 7, 8, 9, 10, 11], 
 [7, 8, 9, 10, 11, 12]]

However, I have to use numpy to do this job as the array is very large.
Does anyone have ideas about how to do the same work in numpy?

  • 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-14T09:10:31+00:00Added an answer on June 14, 2026 at 9:10 am

    Many NumPy binary operators have an outer method which can be used to form the equivalent of a multiplication (or in this case, addition) table:

    In [260]: import numpy as np
    In [255]: a = np.arange(1,7)
    
    In [256]: a
    Out[256]: array([1, 2, 3, 4, 5, 6])
    
    In [259]: np.add.outer(a,a)
    Out[259]: 
    array([[ 2,  3,  4,  5,  6,  7],
           [ 3,  4,  5,  6,  7,  8],
           [ 4,  5,  6,  7,  8,  9],
           [ 5,  6,  7,  8,  9, 10],
           [ 6,  7,  8,  9, 10, 11],
           [ 7,  8,  9, 10, 11, 12]])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Native Array in Emberjs does not support deep copy? I saw it just returning
Possible Duplicate: Can I write native iPhone apps using Python this post Can I
I am trying to use the python interpreter in chef. Below is my naive
with native SQL I get the database time with a statement like: SELECT CURRENT_TIMESTAMP
I'm performing a nested loop in python that is included below. This serves as
Possible Duplicate: Floating point equality in python I have a small issue about my
Have a webapplication with backend developed on python ( running on Django) and front
I've been starting to use Fortran (95) for some numerical code (generating python modules).
Firstly, I realise that this is a very similar question to this one: Which
I have a small database which is legacy from an almost defunct project. This

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.