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
What is one effective way for employees to keep their skill-sets current
natta225 [31]
Is it a multiple choice answer? if so would like to see the answers as there are TONS of effective ways and if i list one it may not be in that list you have if its multiple choice.
3 0
3 years ago
What are the chances that we are living in a simulation? (Percentage)
harkovskaia [24]
Round about 95% Chance to living in a Simulation
5 0
3 years ago
Read 2 more answers
Can someone please tell me how can I code this onto C# on Visual Studio 2019? It’s due tomorrow!!
11111nata11111 [884]

Answer:

i need points

Explanation:

lol

8 0
3 years ago
Select the correct answer.
kicyunya [14]

Answer:

D

Explanation:

pecialisation - departments focus on one area of work. productivity - specialism means that staff are skilled in the tasks they do. accountability - there are clear lines of management. clarity - employees understand their own and others' roles.

7 0
3 years ago
Read 2 more answers
Which function can be used to insert the current date into a spreadsheet?
VladimirAG [237]

Answer:

im pretty sure it MM/DD/YYYY

Explanation:

3 0
3 years ago
Other questions:
  • Which software is used to play, create, and modify audio and video files?
    7·2 answers
  • Who needs to be involved when assembling business solutions that include hardware and software?
    11·2 answers
  • Which statement is used to create a file object that will append data to an existing file? BufferedWriter salesdata =
    7·2 answers
  • Where is NumPy used?
    6·2 answers
  • When was the federal commission act put into effect?????
    13·1 answer
  • What is the name of the virus that appears to be a legitimate program but when opened
    9·1 answer
  • Users can customize their Windows device by going to the Control Panel under __________.
    15·2 answers
  • Some machine/items/gadget having only hardware​
    8·1 answer
  • Lesson 2.7 Code Practice #2
    13·1 answer
  • During prereading, it is not important to pay attention to visual aids. please select the best answer from the choices provided
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!