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
Aleks [24]
2 years ago
14

10. Write a function called replace_elem that takes an array and two values and uses the simple search

Computers and Technology
1 answer:
zalisa [80]2 years ago
8 0

The function that replaces the values in an array is as follows:

def replace_elem(a, integer1, integer2):

    for i in range(len(a)):

         if a[i] == integer1:

              a[i] = integer2

    return a

print(replace_elem([7, 4, 10, 3, 7, 2, 4, 5], 4, 6))

<h3>Code explanation.</h3>

The code is written in python.

  • We defined a function named "replace_elem". The function accepts an array a, and integers integer1 and integer2.
  • Then, we used a loop to loop the index of the array.
  • If any of the index value is equals to the integer1, we replace it with integer2.
  • Then return the new values of the array a.
  • Finally, we call the function with its parameters.

learn more on function here: brainly.com/question/15691123

You might be interested in
The ---------------initiates a message by encoding theidea (or a thought) in words or symbols and sends it to areceiver.ChannelS
saw5 [17]

Answer:

None of the given options

Explanation:

The sender initiates a message by encoding theidea (or a thought) in words or symbols and sends it to a receiver.

8 0
2 years ago
Every page on a website must be updated recently to consider the website updated/maintained
guajiro [1.7K]
Unmaintained. hope that helped
6 0
3 years ago
Read 2 more answers
Write two statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a slash, and
Montano1993 [528]

Answer:

1/2000

Explanation:

import java.util.Scanner;

public class InputExample {

public static void main(String [] args) {

Scanner scnr = new Scanner(System.in);

System.out.print("Enter birth month and date:");//comment this line if not needed

int birthMonth=scnr.nextInt();

int birthYear=scnr.nextInt();

String output= birthMonth+"/"+birthYear+"\n";

System.out.println(output);

}

}

if using this code the out put should be 1/2000

5 0
3 years ago
How to get amount after a percentage increase in excel​
Tresset [83]

Answer:

First: work out the difference (increase) between the two numbers you are comparing.

Increase = New Number - Original Number.

Then: divide the increase by the original number and multiply the answer by 100.

% increase = Increase ÷ Original Number × 100.

Explanation:

3 0
2 years ago
Read 2 more answers
Why do you think there needs to be a specific code of ethics for health-related information on the Internet?
Firlakuza [10]
Ethical health research and privacy protections both provide valuable benefits to society. Health research is vital to improving human health and health care. Protecting patients involved in research from harm and preserving their rights is essential to ethical research. The primary justification for protecting personal privacy is to protect the interests of individuals. In contrast, the primary justification for collecting personally identifiable health information for health research is to benefit society. But it is important to stress that privacy also has value at the societal level, because it permits complex activities, including research and public health activities to be carried out in ways that protect individuals’ dignity. At the same time, health research can benefit individuals, for example, when it facilitates access to new therapies, improved diagnostics, and more effective ways to prevent illness and deliver care
7 0
3 years ago
Read 2 more answers
Other questions:
  • "Server Manager will allow you to manage all roles and features installed on any server, and view the status of all your servers
    7·1 answer
  • Building relationships during your career exploration is called
    9·2 answers
  • Anti-bullying laws in most states are designed to provide
    14·2 answers
  • When shooting in a windy outdoor environment a ___should be placed over the mic
    7·1 answer
  • Draw the hierarchy chart and then plan the logic for a program that calculates a person’s body mass index (BMI).
    11·1 answer
  • Rick is linking different pages in his website. Match the value of the attribute to its meaning to enable Rick to choose the mos
    13·1 answer
  • What number system do people in America use?
    10·2 answers
  • sandra has houseplants sitting on her kitchen windowsill, where it receives a lot of sunlight . what will most likely be the pla
    9·2 answers
  • What can provides access to the only menu in office 2007​
    13·1 answer
  • Utilizando o padrão de medidas e unidades do National Institute of Standards and Technology, em que 1 KB é igual a 1.000 Bytes,
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!