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
A firewall is either software or dedicated hardware that exists between the __________ being protected.
Lapatulllka [165]

A firewall is either software or dedicated hardware that exists between the network and the resource being protected. this network security device monitors traffic to or from the network. It is based on set of rules about what data packets will be allowed to enter or leave a network.

5 0
2 years ago
In a Java Script language. create a two-dimension array consisting of numbers representing costs. After creating the array, prin
Tanzania [10]

Answer:

Can you elaborate more?

Explanation:

5 0
3 years ago
What is GIGO ?<br>plz answer me​
DanielleElmas [232]

Answer:

Garbage in, garbage out

Explanation:

In computer science, garbage in, garbage out is the concept that flawed, or nonsense input data produces nonsense output or garbage

4 0
2 years ago
Nicotine us a dangerous chemical found in Cigarettes; it is accompanied by two other very harmful chemicals. These are
NNADVOKAT [17]

Answer: Carbon Monoxide and Tar.

4 0
2 years ago
How many times is the function wordScramble() called in the given program? public class WordScramble { public static void wordSc
Ainat [17]

Answer:

The answer is "2"

Explanation:

  • In the given java program code, a class WordScramble is declared, inside the class, a static method wordScramble is declared, that accepts two string parameter that is "rem and scr".
  • Inside the method a conditional statement is used in the if the block it checks rem variable value is empty so, it will add rem and scr value.  Otherwise, it will go to else block in this a loop is defined, which calls the method, which calculates rem length that is 2, and this method call two times to rearrange the values.
  • In the next step main method is defined that calls wordScramble method, which passes only one argument "ab" in its first parameter.
  • This method accepts one string value, in which there are two numbers   "a and b" that's why the method will run two times.  
6 0
3 years ago
Other questions:
  • The EPA requires the use of precise forms called ?
    14·1 answer
  • How do the search methods differ for primary and secondary data?
    10·2 answers
  • In Paint, which of the following are ways to use a picture that you have saved on your computer? (Select all that apply.)
    8·1 answer
  • A network administrator recently implemented two caching proxy servers on the network. how can the administrator best aggregate
    5·1 answer
  • Select the antonym for given word freedom
    7·2 answers
  • Exercise 4: Bring in program grades.cpp and grades.txt from the Lab 10 folder. Fill in the code in bold so that the data is prop
    12·1 answer
  • Which network component is used to connect one network to another? Which component delivers the message to the destination compu
    5·1 answer
  • 8.7 Code Practice: Question 2 edhesive
    14·2 answers
  • 1. Write an if statement that assigns 20 to the variable y, and assigns 40 to the variable z
    10·1 answer
  • Why is lateral reading an important tool when reading material in social media or any online source
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!