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
Vladimir79 [104]
3 years ago
6

The aim of this activity is to implement an algorithm that returns the union of elements in a collection. Although working with

sets is quick and easy in Python, sometimes we might want to find the union between two lists. Create a function called unite_lists, which uses a loop to go through both lists and return common elements. Do not use the built-in set function.
Computers and Technology
1 answer:
shusha [124]3 years ago
3 0

Answer:

The function in Python is as follows:

def unite_lists(A, B):

   union = []

   for elem in A:

       if elem in B:

           union.append(elem)

   return union

Explanation:

This defines the function

def unite_lists(A, B):

This initializes an empty list for the union list

   union = []

This iterates through list A

   for elem in A:

This checks if the item in list A is in list B

       if elem in B:

If it is present, the item is appended to the union list

           union.append(elem)

This returns the union of the two lists

   return union

You might be interested in
Design an if-then statement ( or a flowchart with a single alternative decision structure that assigns 20 to the variable y and
xz_007 [3.2K]

Answer:

The conditional statement and its flowchart can be defined as follows:

Explanation:

Conditional statement:

if x>100 Then //defining if that check x value greater than 100

y=20//holding value in the y variable

z=40//holding value in z variable

End if

5 0
3 years ago
Which specialized information system is used by passport agencies and border inspection agencies to check the names
katovenus [111]

Answer:

Consular Lookup and Support System

5 0
2 years ago
Derek is working at the help desk when he receives a call from a client about an issue with the company's email. The customer is
jeka57 [31]

Answer:

Give the customer time to express his/her anger and then restart the conversation.

Explanation:

A person working as a help desk executive is meant to be equipped with customer service skills and experience. They are the mediator between the customers and the actual service providers in a company.

A good help desk executive should have good communication skills, they should have the ability to diffuse tension which it needed in this context.

7 0
3 years ago
Suppose we wish to put a set of names in alphabetical order. We call the act of doing so sorting. One algorithm that can accompl
Sergeeva-Olga [200]

Answer:

See explaination

Explanation:

We refer to a compiler as a special program that processes statements written in a particular programming language and turns them into machine language or "code" that a computer's processor uses. Typically, a programmer writes language statements in a language such as Pascal or C one line at a time using an editor.

Please kindly check attachment for the step by step solution

3 0
3 years ago
What will be the value of x after the following loop terminates?
Katena32 [7]

Answer:

10

Explanation:

This for-loop is simply iterating three times in which the value of x is being set to the value of x * 1.  So let's perform these iterations:

x = 10

When i = 0

x = x * 1 ==> 10

When i = 1

x = x * 1 ==> 10

When i = 2

x = x * 1 ==> 10

And then the for-loop terminates, leaving the value of x as 10.

Hence, the value of x is equal to 10.

Cheers.

7 0
3 years ago
Other questions:
  • Data governance consists of? A. the processes, methods, and techniques to ensure that data is of high quality, reliable, and uni
    11·1 answer
  • Let’s say you’re publishing a message with the Hootsuite Composer. The message contains a link to a landing page, and you want t
    9·1 answer
  • Yesterday you installed a new game on your computer. When you ran the computer, you noticed that the application was running ver
    15·1 answer
  • What malware looks like a useful or desired executable program but is, in reality, a program that is supposed to cause harm to y
    11·1 answer
  • Can somebody do an Algorithm 2 for more?<br> (Python)
    15·1 answer
  • Why does computer uses 0s and 1s to procress data​
    7·2 answers
  • A good information that contains the facts necessary for decision makers to solve a problem is characterized by the __________.
    15·2 answers
  • You can put ______ on your phone.
    10·1 answer
  • A friend wants to design an app but has never done so before and isn't sure how to begin. What would you suggest they do first?
    7·1 answer
  • PLEASE ANSWER AND HURRY I'LL MARK YOU BRAINLIEST!!<br><br><br>​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!