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
What technique is most commonly associated with the use of malicious flash drives by penetration testers
nasty-shy [4]

Answer: Distributing malicious flash drives in a parking lot or other high-traffic area, often with a label that will tempt the person who finds it into plugging it in, is a technique used by penetration testers.

Explanation:

4 0
1 year ago
Open Comments.java and write a class that uses the command window to display the following statement about comments:
riadik2000 [5.3K]

Answer:

Answers to the code are given below with appropriate guidelines on definitions and how to properly run the code

Explanation:

//3 ways to comment are as follows:

//1. This is a one line comment.

/**

* 2. This is a documentation comment.

* @author Your name here

*

*/

/*

*3. This is a multiple line comment

* */

public class Comments {

//Driver method

public static void main(String[]args) {

/*

* All the text written inside the

* sysout method will be displayed on

* to the command prompt/console*/

System.out.println("Program comments are nonexecuting statements you add to a file for the purpose of documentation.\n");

System.out.println("3 ways to add comments in JAVA are as follows: \n");

System.out.println("1. One line comment can be written as:\n//Program comments are nonexecuting statements you add to a file for the purpose of documentation.\n");

System.out.println("2. MultiLine comment can be written as:\n/* Program comments are nonexecuting \n * statements you add to a file for the \n * purpose of documentation.\n */\n");

System.out.println("3. Documentation comment can be written as follows:\n/**\n * Program comments are nonexecuting statements you add to a file for the purpose of documentation.\n **/");

}

}

Steps to Run:

1. Make file named Comments.java, and copy paste the above code.

2. Open command prompt and then go to the directory where you have saved the above created file.

3. The before running compile the code by using command

javac Comments.java

4. Now, run the code by the below command

java Comments.

Congrats your assignment is done!!

8 0
3 years ago
Common separators or delimiters used when converting a table to text include _______________________ , paragraph marks, or comma
Anon25 [30]

Answer:

tabs.

Explanation:

Microsoft Word refers to a word processing software application or program developed by Microsoft Inc. to enable its users to type, format and save text-based documents.

In Microsoft Word 2019, the users are availed with the ability to edit the word document in the following view type;

I. View Mode.

II. Print Mode.

III. Drift Layout.

To easily and quickly convert text to tables in Microsoft Word, you should insert common separators between the text columns. The common separators or delimiters used when converting a table to text include tabs, paragraph marks, or commas.

Tabs or commas are used to indicate where the texts are divided into table columns while paragraph marks indicate where a new table row begins.

6 0
3 years ago
Which of the following technologies uses the results of a scientific discovery?
belka [17]
D. All of these
Reason being, they wouldn't have been made if something hasn't been discovered about them.

4 0
2 years ago
Read 2 more answers
What are the tab keys used for on a keyboard
Ugo [173]
The tab keys are used to advance the cursor to the next tab stop.
4 0
3 years ago
Other questions:
  • HELP PLEASE
    7·2 answers
  • _____ is a function performed by control programs that manages computer resources, such as storage and memory.
    11·1 answer
  • Which of the following is the best definition of a workplace policy?
    13·2 answers
  • During an interview, your _____ can be as influential as your skills and abilities
    11·2 answers
  • Which type of address defines a single network interface in a computer or other device?
    7·1 answer
  • Ar count = 10;
    13·1 answer
  • (I WILL GIVE BRAINLIEST) Which steps will delete an appointment?
    8·1 answer
  • Have y’all enjoyed The new hero floryn from Mobile legends
    6·1 answer
  • Where do you interact with databases on a daily basis?
    10·2 answers
  • 5. Nadia wants to calculate the total interest, which is the total amount of the payments minus the loan amount. In cell F6, ent
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!