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
lana66690 [7]
3 years ago
10

write a function that takes two integer arrays as input return true if any two of the numbers in the first array input add up to

any of the numbers in the second array tests return false
Computers and Technology
1 answer:
Afina-wow [57]3 years ago
8 0

Answer:

Explanation:

This program is written in Python. It is a function that takes in two arrays. Then it loops through the first array twice, adding each element with the others and comparing the sum to the values in the second array. If a similar value is found in the second array, the program prints out the value and returns True to the user. Otherwise, it returns False. A test case has been created with two array variables that print out False, the output can be seen in the attached image below.

def sumArray(arr1, arr2):

   for i in range(len(arr1)):

       for x in range(len(arr1)):

           sum = 0

           if i != x:

               sum = arr1[i] + arr1[x]

           if sum in arr2:

               print(str(sum) + "Found in Second Array")

               return True

   return False

arr1 = [1, 9, 10, 44]

arr2 = [2, 4, 8, 14]

print(sumArray(arr1, arr2))

You might be interested in
Design a program that will ask the user to enter the amount of a purchase. The program
LUCKY_DIMON [66]

The program is a sequential program, and they do not require loops and conditions

<h3>The program design in Python</h3>

The complete program written in Python is as follows:

purchaseAmount = float(input("Amount: "))

stateSalesTax = 0.05 * purchaseAmount

provincialSalesTax = 0.02 * purchaseAmount

print("Amount:",purchaseAmount)

print("State sales tax:",stateSalesTax)

print("Provincial sales tax:",provincialSalesTax)

print("Total sales tax:",(stateSalesTax + provincialSalesTax))

print("Total sales:",(purchaseAmount + stateSalesTax + provincialSalesTax))

Read more about Python programs at:

brainly.com/question/26497128

#SPJ1

4 0
2 years ago
Which risk management framework does the organization of standardization publish
olga2289 [7]

Answer:

ISO 31000:2009 publishes principles and generic guidelines on risk management.

Explanation:

ISO 31000:2009 can be applied to any public, private or community company, organization, society or individual. Hence, ISO 31000:2009 is not particular to either business or area.

ISO 31000:2009 can be implemented during the period of an industry and to a broad variety of actions, including policies and judgments, guidance, methods, functions, plans, goods, services, and assets.

ISO 31000:2009 can be implemented to any type of danger, whatever its kind, whether possessing positive or negative outgrowths.

3 0
4 years ago
Assume a program requires the execution of 50 x 106 FP instructions, 110 x 106 INT instructions, 80 x 106 L/S instructions, and
Molodets [167]

Explanation:

FP - 50 \times 10^6

CPI - 1

INT -110 \times 10^6,

CPI - 1

I/S - 80 \times 10^6 ,

CPI - 4

Branch - 16 \times 10^6

CPI - 2

Clock Speed - 2 \times 10^9

Time(old) =\frac{50 x 10^6 + 110 x 10^6 + 4 x ( 80 x 10^6) + 2 x (16 x 10^ 6)}{2 x 10^9}

Time(old) = 256 \times 10^ {-3}

Time(new) =  \frac{256 \times 10^{-3}}{2}

                = 128 \times 10^{-3}

                =\frac{CPI(new) x [50 x 10^6 + 110 x 10^6 + 4 x ( 80 x 10^6) + 2 x (16 x 10^ 6)]}{2 x 10^9}

                =  128 \times 10^{-3}

CPI(new) = \frac{-206}{50}

               = -4.12

3 0
3 years ago
in a flashlight many parts work together as a system. which of the following parts is considered the output in this particular s
kap26 [50]
C. The light bulb
Light is not a part of the flashlight and everything is working together to output light from the bulb
7 0
3 years ago
Read 2 more answers
The IP protocol (and UDP) are called "connectionless" and "unreliable." Describe what those two words mean in the context of dat
igor_vitrenko [27]

Answer:

Explanation:

In data communications, a protocol is <em>connectionless </em>if it describes communication between two devices in a network without first establishing or verifying establishment of some link (connection) between the two devices. In a connectionless protocol, data are exchanged between processes or devices without a prior check of whether the processes are ready to transmit data or not. In this type of protocol, there's no verification put in place to remember if these processes were or are in communication. Connectionless protocols are also called stateless protocols. Because connectionless protocol cannot be relied upon due to its lack of delivery-assurance policy, it is sometimes referred to as <em>unreliable protocol</em>. In other words, delivery of data packets is not guaranteed. An example of a connectionless protocol is the UDP (User Datagram Protocol).

However, if the protocol defines some checks to ascertain that there is first a connection between two communicating processes before beginning transmission, then, the protocol is <em>connection-oriented. </em>An example of this is the TCP (Transmission Control Protocol). Connection-oriented protocols are reliable since they ensure connection be made between processes before transmitting data packets.

A typical application of a connectionless/unreliable protocol is in the streaming of real time videos or voice communication where packets of data could be dropped and not resent.

An example of the connection-oriented/reliable protocol is analogous to making a telephone call where data packets (voice messages) are not sent until the receiver on the other end makes a connection.

6 0
3 years ago
Other questions:
  • Eva is listening to music while she browses the Internet. Which type of operating system must she be using?
    10·2 answers
  • Briefly explain what is net neutrality and why is it important today
    15·1 answer
  • A number of related records that are treated as a unit is called
    6·1 answer
  • Which step is first in changing the proofing language of an entire document?
    11·1 answer
  • 5. What is the purpose of OneDrive? A. OneDrive organizes files on an external hard drive. B. OneDrive allows the user to work o
    7·1 answer
  • Where do file name extensions appear?
    14·1 answer
  • Which are the following 4 things something must be able to do in order to be a computer? *
    9·1 answer
  • Can people survive without technology?
    5·1 answer
  • What rpm command can be used to list the full paths for files within the bash package?
    10·1 answer
  • Why should you avoid the use of sarcasm, clichés, and idioms in business<br> letters
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!