1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kotykmax [81]
3 years ago
15

Write a function that given an integer N(1<=N<=100) returns an array containing N distinct Integers that sum up to 0. The

function can return any such array. For example, given N=4, the function could return (1,0,-3, 2], and for N=3 one of the possible answers is [-1,0,1] (but there are many more correct answers)
Computers and Technology
1 answer:
Lostsunrise [7]3 years ago
6 0

Answer:

Explanation:

This is simple. I We begin by creating 2 groups of equal and opposite. The total number of elements in both group is N (if N is even) or N-1(if N is odd). The total value of both group should equal to 0. Add 0 if N is odd

We can code this function in python

def array_maker(N):

    if N % 2 == 1:

         if N == 1: # special case

              return [0]

         else:

              left_ray = [i for i in range(-N//2, 1)]

              right_ray = [i for i in range(N//2)]

              left_ray.extend(right_ray)

              return left_ray

    else:

         left_ray = [i for i in range(-N/2, 0)]

         right_ray = [i for i in range(N/2)]

         left_ray.extend(right_ray)

         return left_ray

You might be interested in
Which of the following is not a type of bank?
andreyandreev [35.5K]
Where is the following banks that is listed?
3 0
3 years ago
Read 2 more answers
The Internet is written in a "language" called
olganol [36]

Answer:

HTTP

Explanation:

I hope it helps u.

Mark Me as brainlist answer

4 0
3 years ago
Read 2 more answers
Martha is a healer, a healthcare provider, and an experienced nurse. She wants to share her daily experiences, as well as her 12
STALIN [3.7K]
The answer to the question is blog.
4 0
4 years ago
Read 2 more answers
Why hackers hack?? in other people?​
pshichka [43]
Could you please reword this question. i don’t get what you’re asking
8 0
3 years ago
Read 2 more answers
_____ of a global information system (GIS) concentrates on medium-range activities that move an organization toward achieving lo
Dafna11 [192]

Answer: (A) Tactical support

Explanation:

 GIS is the global information system in which the data is delivered worldwide in the form of information system. The global information system achieve long term goals in an organization.

  • The tactical support is used in the global information system for concentrating the activities on the medium range in an organization.  
  • The tactical support is one of the effective way to producing the desirable result and also achieve the main strategic objective.

Therefore, Option (A) is correct.

8 0
3 years ago
Other questions:
  • One critique of determining the effectiveness of the psychodynamic perspective is that its theories are too vague to test. t/f
    14·2 answers
  • Melissa and Sue want to distribute a document to be discussed at a meeting starting in about thirty minutes. People will be atte
    14·1 answer
  • Which command group does a user need to access the Formula dialog box?
    11·1 answer
  • Which of the following are engine features of 2018 TITAN XD Diesel but not of 2018 TITAN XD Gas?
    13·1 answer
  • What are the two most common form factors used today for computer cases, power supplies, and motherboards?
    15·1 answer
  • What is a half note + a 8th note in band? plz helppp
    11·2 answers
  • How is a technical certificate like a computer-related associate degree?
    12·2 answers
  • ____ are likely in the event of a hacker attack, when the attacker retreats to a chat room and describes in specific detail to h
    5·1 answer
  • HELP!! TIMED TEST!! Match the item to its description. 1. icons place where frequently used programs can be opened 2. Quick Laun
    13·1 answer
  • The contribution of Charles Babbage in the history of computer​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!