10. Write a function called replace_elem that takes an array and two values and uses the simple search
algorithm to replace all instances of the first value with the second value
Sample Run 1:
a = [7, 4, 10, 3, 7, 2, 4, 5]
print (replace_elem(a, 4, 6))
Should output:
[7, 6, 10, 3, 7, 2, 6, 5]
Sample Run 2
a = [7, 3, 10, 3, 7, 2, 9, 5]
print (replace elem(a, 4, 6))
Should output
[7, 3, 10, 3, 7, 2, 9, 5]

Answers

Answer 1

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))

Code explanation.

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: https://brainly.com/question/15691123

10. Write A Function Called Replace_elem That Takes An Array And Two Values And Uses The Simple Searchalgorithm

Related Questions

state the name of the following computer components​

Answers

Answer:

Memory.

Hard Drive or Solid State Drive.

Video card.

Motherboard.

Processor.

Power Supply.

Monitor.

Keyboard and Mouse.

Explanation:

Memory
Hard Drive or Solid State Drive
Video card
Motherboard
Processor
Power Supply
Monitor
Keyboard and Mouse
Optical Drive DVD/RW
Ethernet or Wireless card


Central Processing Unit (Cpu)
Random Access Memory (Ram)
Motherboard
Solid State Drive (Ssd)
Three
Games User Interface
Floppy Drive
Conclusion
The Motherboard
Usb Ports
Hardware And Software
Disk Drive
Optical Disk Storage
Scsi
Laser Printer
Processing Devices
Keyboard And Mouse
Lcd
Internal
External
Stylus
Code
Non Volatile Memory
Utility Software

answer quickly!!!!! please answer as soon as you see this!
Which feature of a database displays data in a certain sequence, such as alphabetical order?

Chart
Filter
Search
Sort

Answers

Sort is the answer to this

explain the measures put in place in order to maintain each of the element of computer security

Answers

Answer:

Contains a firewall.

Try's to keep all software up to date.

Able to use antivirus software and keep it current.

Allows you to use a password

Explanation:

Computer security is important because it keeps your information protected. It's also important for your computer's overall health

Please have a great day <3

RAM is like a computer’s ______________, while a hard drive is like a computer’s ______________

Answers

Explanation:

RAM is what the computer and the applications run on and hard drive is the type of memory all your files and apps are located on

Explain the relationship between one’s point of view and understanding spoken text

Answers

In spoken and audio texts the tone and accompanying sounds convey a point of view. Point of view therefore constructs an attitude towards the subject matter in a text which the reader, listener or viewer is invited to adopt.

Please have a wonderful day <3

You have a filtered dataset for Customer Sales with some null value rows. You want to remove these rows completely. How will you do this

Answers

The option is to Deselect (blank) in the pull-down menu for Customer Sales in the dataset.

How do one delete these rows completely?

If a person is working in the Query Editor (that is the place where one can get data, before you close and apply).

The right thing to do is to select the column that  you want to use to check for nulls and when  the values you are looking at is really blank, you can then click the drop-down and delete Rows in the ribbon, then one can click the option of Remove Blank Rows.

See full options below

Select an answer:

Deselect (null) in the pull-down menu for Customer Sales in the Power Query Editor.

Deselect (blank) in the pull-down menu for Customer Sales in the dataset.

Change the filter so null value rows are not displayed.

Place your cursor to the left of the rows, and then select Delete.

Learn more about dataset from

https://brainly.com/question/24309209

help meeeeeeeeeeeeeeeee

Answers

Answer:

The advantages include much access to photos, digital functions like games and contacts with friends, videos, and you can search questions to anything you like. Disadvantages include things like too much screen time affecting sleep, health, and other physical problems. There is also exposure to explicit content and hatred from strangers.

There are hundreds of editing software for you to try, and many are free to use and are even compatible offline. They can make content related to or look like something in a movie or can be used to make things look nicer and cooler.

[ASAP!] What is a widget?

1. a part of a GUI that allows a specific type of interaction with the user
2. an action taken by the user or a process, such as a user clicking a mouse or pressing a key on a keyboard
3. an algorithm for handling an error
4. a part of a program that responds to an event​

Answers

Answer:

A

Explanation:

A part of a GUI is the basic definition of a widget.

Comment any additional questions!

Answer:

A or number 1

Explanation:

I took the test and got a 100%, and this answer makes the most sense

What is the scope of AS-26

A. All of these
B.Rights and Expenditure on the exploration for or development of Minerals
C. Financial Assets
D. Intangible Assets that are covered by another as

Answers

Answer:

is held for use in the production or supply of goods and services or for rentals to others etc

write an assembly program that uses the output compare function of a timer to toggle an led every second

Answers

; Set up output compare function

movlw 0x3E

movwf TOCON

; Set up LED port as output

bcf TRISB, 0

; Set up timer

movlw 0xFF

movwf TMR1

movlw 0x60

movwf PR1

; Enable timer and output compare function

bsf T1CON, TMR1ON

bsf T1CON, T1OSCEN

; Main loop

loop:

   ; Wait for output compare event

   btfss T1CON, OCF1

   goto loop

   ; Toggle LED

   bcf PORTB, 0

   btfss PORTB, 0

   bsf PORTB, 0

   ; Clear output compare flag

   bcf T1CON, OCF1

   ; Repeat

   goto loop

please answer this question​

Answers

The salary calculator program is an illustration of a sequential program

What are sequential programs?

Sequential programs are programs that do not require loops, iterations or conditional statements

How to write the main program

The program written in Python, where comments are used to explain each action is as follows:

#This initializes the base number of hours

baseHours = 40

#This initializes the base payment

basePay = 600

#This initializes the overtime payment

overtimePay = 300

#This initializes the total hours worked

hoursWorked = 45

#This calculates the total payment

totalPay = baseHours * basePay + (hoursWorked - baseHours) * overtimePay

#This prints the total payment

print(totalPay)

Read more about sequential programs at:

https://brainly.com/question/26642771

You have been asked to investigate a web server for possible intrusion. You identify a script with the following code. What language is the code in and does it seem likely to be malicious? import os, sockets, syslog def r_conn(ip) s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) s.connect(("logging.trusted.foo",514))

Answers

The code below is written in JavaScript and does not seem malicious.

What is a Malicious Code?

A Malicious code is one that is not designed for any productive end but to cause disruptions in the computer with the objective of

harming the workstation; or destroying the data stored therein.

There are numerous classifications of malicious codes and they can be identified and removed by an application called an Anti-Virus or malicious app remover.

Learn more about JavaScript at:
https://brainly.com/question/16698901

You work as an assistant in your school’s computer lab. A student asks you to help her install a program on her laptop using an installation disc she borrowed from a friend. You read the EULA and notice that it provides only a single-user license. What are the ethical and legal issues surrounding using a single-user license on more than one computer? What should you do?

Answers

The ethical and legal issues surrounding using a single-user license on more than one computer is that if caught, it can lead to termination of the software package that you are in.

The ethical implication is that one cannot be trusted, our integrity has have brought down to zero. The right thing to do is to explain to the student and if you can, get her another software.

What is single user License agreement?

Single User License is a term that connote that there shall be only one person to use, receive and access a product or software  and it cannot be shared with other individuals.

In Single user, the software is said to be licensed for a single user and not for Multi-user.

Learn more about User License  from

https://brainly.com/question/13502276

For optimum computer performance, what features and or characteristics should a
computer possess to efficiently copy any material from an external device?

Answers

A computer should be compactible and possess a good cache memory size, so as to efficiently copy any material from an external device.

What is a computer?

A computer refers to an electronic device that is designed and developed to receive data in its raw form as an input and processes these data into an output (information) that could be used by an end user.

For optimum computer performance, some of the features and or characteristics that a computer should possess, so as to efficiently copy any material from an external device (hard-disk drive) are:

CompatibilityCache memory size.The computer should have a USB 3.0 port.

Read more on computer here: brainly.com/question/959479


________ can contain stacked images, text, and other elements which collectively comprise a Photoshop file.

Answers

If you don’t mind can u add the picture it helps me Answer the question better

True or false: the HTTPs means that the information on a website has been fact-checked
True
False

Answers

Answer:

False

Explanation:

Two support services supervisors disagree about a position description for a new help desk position. One said, “The position description should be written as general as possible so we can choose any applicant we want.” The other said, “The position description should be as specific as we can make it so applicants will know whether or not they meet our requirements.” With which supervisor do you agree? Explain why?​

Answers

I aggree with the one that says "The position description should be as specific as we can make it so applicants will know whether or not they meet our requirements.”

Note that when the  specific requirements about a position is made known, it makes the applicant to known if they are fit for that position or not

What is a position description?

The term  position description is also known as "PD" . This is known to be a fact or a statement that talks about the key duties, responsibilities, and role etc. of a position.

It helps to indicates the work to be carried out by the position and when it is specific, one can know if they can do the work or not.

Learn more about position description from

https://brainly.com/question/4677114

A system that stores transactions in a single database, but processes them at various sites is referred to as

a. Centralized system.

b. Database management normalization system.

c. Decentralized system.

d. Distributed system

Answers

Answer:

d. Distributed system

Explanation:

this answer is taken from the book Wiley CPAexcel Exam Review 2015 Study Guide July: Business Environment

its important to remember that it is a single database however the processing takes place off-site. this off-site is the key to remembering it is DISTRIBUTED through various sites

(40 PTS) Be specific
Imagine that your computer came to life, grew some arms and legs, and wants to work as your faithful butler. It only understands the most basic commands, and its only desire is to make you delicious food.
You have a jar of peanut butter, a jar of grape jelly, a loaf of bread, and a knife. How would you explain to your computer the process of making a peanut butter and jelly sandwich? Write the commands below as precisely as possible. (Be sure to use definitions if you’re using functions to complete more than one action!

Answers

Answer:

Take a knife. Cut the bread. Open the jar of peanut butter and jelly. Scope of a big chunk of peanut butter and

Does anyone who uses Visual Studios 2022 know what tool name it is for the pop up menu? Do not send me links please.​

Answers

Answer:

The Commands and Menu Bar

Explanation:

Answer:

are u using a laptop? if so click the window botton if u download the visual studio code 2022 if u didnt download it use the search bar at the bottom of your screen "type here to search" and type in visual studio code 2022 and it will show up so click on it.

A new robot is created to explore volcanoes on other planets. Which robot is
most likely to have been referenced in the design of the new robot?
A. Dante
B. Roomba
C. ASIMO
D. Sophia

Answers

Answer:

A

Explanation: Dante II is a unique walking robot that provides important insight into high-mobility robotic locomotion and remote robotic exploration. Dante's uniqueness stems from its combined legged and rappelling mobility system, its scanning laser rangefinder and its multi-level control scheme.

Which item is used in Excel to identify the row of a particular cell?
letter
number
type
sheet

The answer is B) number

Answers

Answer:

B) number

Explanation:

you are correct! for instance the cell E3 has the column E and the row 3

The quickest way to change a word is to double
click it.
Select the correct answer
O True
False

Answers

Answer:

I don't think that the fastest way to change a word is to double click it. Even though it highlights it super fast, then you just press backspace once, it doesn't compare to the one where you press the "ctrl" and "backspace" key at the same time, and it makes the whole entire word disappear in the blink of an eye. But, I am not sure if anybody really knows about this trick. So, it is 50/50.

Explanation:

:)

Which string method returns true if the character is a lowercase letter?

letter = input("Enter a letter: ")

islower(letter)

isLower(letter)

letter.islower() * is correct

letter.isLower()

Answers

The right answer is : is.lower(letter)

Answer: islower(letter)

Explanation: got it right on edgen

Woulf you rather :
Be a Alpha Wolf
or
Be a Alpha Shark

Answers

Answer:

Alpha wolf

Explanation:

Their superior

(also what is this question? lol)

Answer:

don't know just wanted my points you stole

Explanation:

Which statement best characterizes under what circumstances you should add your social media profile to a resume? You should add your profile even if it is not entirely professional. You should add your profile even if it is not entirely professional. You should add your profile, but it should be entertaining and help you stand out. You should add your profile, but it should be entertaining and help you stand out. You should not add your profile under any circumstances—it is unprofessional. You should not add your profile under any circumstances—it is unprofessional. You should add your profile, but it should be professional and positive.

Answers

Answer:

You should add your profile, but it should be professional and positive.

Explanation:

this is the most reasonable response... resumes are for careers and professions.. so you must be professional and positive (if it is for example linkedin)

Similarities in off-site and On-site

Answers

Answer:

Off prevents the page from finding your easy search terms; basically what you search for, while On page will help you improve the quality of your newly designed web page.

▬▬▬Casual Terms▬▬▬

Off page means that you are not actively viewing a page; unlike On, it would mean the exact opposite.

▬▬▬Conclusion▬▬▬

I Hope you have a great day!

Answer:

onsite is on or at a site while offsite is away from a mail location in a place not owned by a particular organization.

Is hacking always wrong? Creating viruses?

Answers

Answer:

yes

Explanation:

Answer:

Not every “hack” is bad, and not every hacker is a criminal. In fact, many hackers secure websites and companies from malicious actors.

creating viruses is done by negative intention hackers

IM a bit confused on what this is asking for exactly.

Answers

Answer:

im not sure can you ask someone for help

Explanation:

Please help me answer this in c++, I'm having problems trying to complete this program, thank you!
Modify the mortgage program to display 3 mortgage loans: 7 year at 5.35%, 15 year at 5.5 %, and 30 year at 5.75%. Use an array for the different loans. Display the mortgage payment amount for each loan. Do not use a graphical user interface

Answers

The program is an illustration of loops, and loops are used for iterative purposes

The complete program in C++

The main program is not given, so I will write the new program from scratch.

The program written in C++, where comments are used to explain each action is as follows:

#include<iostream>

using namespace std;

int main(){

   //This declares the required variables

   float monthlyPayment, rate, principalAmount, f;

   int years;    f=1;

.................

See attachment for the complete program

}

Read more about loops at:

https://brainly.com/question/24833629

Other Questions
Where can i get an antibody test and is it reliable? What is the United States government equivalent of the Eight Judges in Rome? Congress Twelve Tables Presidential veto Judicial branch Briefly explain the outcome of the Jerusalem Council Before Congress sends a law to be signed by the President, both the House and the Senate must vote to approve the law. What is this an example of?A. federalist governmentB. Bill of Rights provisionsC. a check on each bodyD. Congressional oversight Genetic change caused by mutations in DNA can lead to? what are the three gases our atmosphere is mainly composed of How many different three digit numbers can be made with 123456789 The table shows the number of apples needed to make apple pies and applesauce sold at a farmstore. During a recent picking at the farm, 169 Granny Smith apples and 95 Red Delicious appleswere picked. Write and solve a system to determine how many apple pies and how many batchesof applesauce can be made if every apple is used. (Hint: read across each row to create your equations!)# Needed # Needed TotalType of Apple for 1 (Pie) for SauceGranny Smith 54169Red Delicious3295 Which singer-songwriter was drafted into the u. S. Army in 1966 and served in west germany as a mechanical engineer?. How many grams of oxygen gas are required to react completely with 2.8 g of solid sodiumin a synthesis reaction? I need help on this question What is the volume of a rectangular prism that is 4 ft. by 12 ft. by 6 ft.? Question 21 options: 324 ft. 205 ft. 288 ft. 315 ft. what is the area of the triangle The hyphen in "self-sealing" is used because: What is the volume of this prism?3 cm3 cm20 cm13 cm13 cm6 cm what does erosion do?A. It changes rock chemicallyB.it changes rock particles into rockC.it breaks rock down physically D.it moves pieces of rock Please answer fast its due today What can the people of South Asia do to address the problem of pollution In line 20 what has made all the difference according to the speaker of the poem Write x2 y2 18x 8y 5 = 0 in standard form. group terms and move the constant to the other side of the equation. x2 18x y2 8y = 5 determine the values that need to be added to both sides of the equation. (18 2)2 = 81 and (8 2)2 = 16 add the values to both sides of the equation. write each trinomial as a binomial squared, and simplify the right side. what is the standard form of the equation of a circle given by x2 y2 18x 8y 5 = 0? ( ) ( ) = Find the vertex of this parabola:y = -x2 + 6x 15