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]
3 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]3 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 piece of software tells the operating system how to use a specific hardware device?
professor190 [17]
A driver for that hardware specific task. Like Nvidia makes GPU's so they also make GPU drivers
8 0
4 years ago
The Leader Motive Profile (LMP) includes a: a. high need for power. b. low need for achievement. c. moderate need for power. d.
algol [13]

Answer:

a. is correct

Explanation:

6 0
4 years ago
What expressions will initialize d with a random value such that all possible values for d are given by the inequality 1.5 ≤ d &
Kaylis [27]

Answer:

The solution code is written in Python

d = 1.5 + random.random() * 6

Explanation:

By presuming the Python random module is imported, we can use the <em>random</em> method to generate a random number.  <em>random.random()</em> will give us a value in the range [0, 1). The ensure the lower limit is 1.5 instead of 0, we can add 1.5 to random.random()

  •      1.5 + random.random()

This expression will give any value in range [1.5, 2.5)

To ensure the upper limit is set to 7.5, we tweak the previous expression to

  • 1.5 + random.random() * 6  

This expression will always multiply a random number from [0,1) with 6 and then only added with 1.5. This will always produce a random number that fulfill the inequality 1.5 ≤ d < 7.5

7 0
3 years ago
Front office employees at the Melville Lodge use a computer-based system to manage, among other things, the central reservation
Step2247 [10]

Answer:

Property Management System

Explanation:

A property management system (PMS) is a software sytem used for the operations of hospitality properties and manufacturing industries sometimes.

6 0
4 years ago
What is the simplest way to permanently get rid of an unwanted file? A. Cancel the file. B. Go to the Start menu and then delete
Morgarella [4.7K]
Go to the Start menu and then delete the file <span>is the simplest way to permanently get rid of an unwanted file</span>
5 0
4 years ago
Other questions:
  • What does the dashed line in the beaker separating the two sides represent?______________________?
    13·2 answers
  • What's a qat on a computer
    12·2 answers
  • One of the disadvantages of Audacity is that it has limited technical support since it is a free program.     true or false
    11·2 answers
  • Consider a bit stuffing framing method where the start of a frame is indicated by 6 consecutive ones, followed by 2 zeroes. What
    8·1 answer
  • What is the purpose for adding images and graphics to a web page?
    5·1 answer
  • The document theme does not determine the appearance of the styles. true or false
    13·2 answers
  • John Cleaver is the CEO of Tech World, which is a retail store that sells computers, monitors, cameras, televisions and many oth
    6·1 answer
  • Write a 2-to-3-page research paper describing in plain language the basic purpose, theory, and implementation of GUI application
    6·1 answer
  • Help me code game plz just comment below for more info
    10·2 answers
  • How long does a seller have to ship an item on offerup
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!