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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:47:26+00:00 2026-05-27T04:47:26+00:00

How can I define _SOME CODE_ in the next code fragment in order to

  • 0

How can I define _SOME CODE_ in the next code fragment in order to get the results shown below?

vector = numpy.array([a,b,c,d])
for i in xrange(4):
    print vector[_SOME CODE_ using i]

It sould give me those results:

[a,b,c]
[a,c,d]
[a,b,d]
[b,c,d]

The order is not important.

  • 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-05-27T04:47:26+00:00Added an answer on May 27, 2026 at 4:47 am

    Answer for the edited question:

    >>> vector = numpy.array([0, 1, 2, 3])
    >>> for i in xrange(4):
    ...     print numpy.r_[vector[:i], vector[i+1:]]
    ... 
    [1 2 3]
    [0 2 3]
    [0 1 3]
    [0 1 2]
    

    Answer for the original question: Here’s some random code producing the desired output:

    >>> import numpy
    >>> vector = numpy.array([0,1,2])
    >>> for i in xrange(4):
    ...     print vector + (vector >= i)
    ... 
    [1 2 3]
    [0 2 3]
    [0 1 3]
    [0 1 2]
    

    I’ve got no idea if this is what you want — the requirement specification left some room for interpretation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is some black magic code in c# where you can define the default
I came across this line in some code and can't find the syntax defined
Is there some way I can define String[int] to avoid using String.CharAt(int) ?
Can anyone define WCF? What is the purpose of WCF? What are some good
When we define routes in routes.rb using the name like map.some_link .We can use
You can define 2 variables of the same type in a for loop: int
I can define default value in domain by this way : class ProcessingPriority {
I can define church numerals fairly easy using scheme: > (define f (lambda (x)
In C# we can define a generic type that imposes constraints on the types
In Java you can define generic class that accepts only types that extend a

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.