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
A user reports that nothing happens when he or she attempts to print from the computer at his desk. This points to a possible pr
Mandarinka [93]

The Problem is either File Management or Disk access but the most common issue is due to File management

5 0
3 years ago
1.07 (PX: 2 points)Some early computers protected the operating system by placing it in a memory partition that could not be mod
Anna11 [10]

Answer:

The user cannot make internal changes, or personalize the computer. Also it would make it very easy for viruses to get into the computers and ccorrupt the entire thing. There is a similar example of this today in Modern Day chromebooks, but earlier computers were not as safe or secure. Also the fact that it can takes up massive amounts of data, requiring more server storage or data storage facilities.

6 0
3 years ago
Hola, alguien me puede ayudar¡¡¡¡¡¡¡¡¡¡¡¡
WARRIOR [948]
Hola<span>, </span>Alguien me<span> podría </span>ayudar<span> a realizar una buena sinopsis de la película "</span><span>Jardín de Amapolas" dirigida por Carlos Melo Guevara, gracias? i hope i helped you</span>
4 0
4 years ago
Why would Network Systems employees be employed by the government?
Ghella [55]
Well knowing how the government is with security id go with A. as it makes a lot of sense unlike B and D and if they were looking for software the question would mention it
8 0
3 years ago
Read 2 more answers
How is the internet a vast network?
8_murik_8 [283]

Answer:

it help you with what you need to ask and more

Explanation:

5 0
3 years ago
Other questions:
  • Which of the following is a Microsoft solution that runs on a Microsoft Terminal Services server but appears, to end users, as i
    10·1 answer
  • A network design engineer has been asked to design the IP addressing scheme for a customer network. The network will use IP addr
    6·1 answer
  • ____ technology essentially takes the data to be transmitted and rather than transmitting it in a fixed bandwidth spreads it ove
    15·1 answer
  • Which strategy would most likely improve a student's reading comprehension?
    8·2 answers
  • Write a while loop that prints
    13·1 answer
  • Write an application for Cody’s Car Care Shop that shows a user a list of available services: oil change, tire rotation, battery
    14·1 answer
  • What type of device is the keyboard?<br><br> Output<br> Input<br> Monitoring<br> Software
    7·2 answers
  • after installing a secondary hard drive what needs to be done to the hard drive and what do these two task do?
    12·1 answer
  • What are some options available when you click File and then Print? (Multiple Choice)
    5·1 answer
  • Which of the following statement is true? Single choice. (2 Points) Views are virtual tables that are compiled at run time All o
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!