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
Mila [183]
3 years ago
9

Write a function get_common_elems(lst1, lst2) that takes two lists of integers, lst1, and lst2, and returns a new list containin

g the elements in common between the two lists. You can assume that there are no repeated elements in the lists. Also, the ordering of the elements in the returned new list is not significant. The function signature is given below: def get_common_elems(lst1,lst2): sig : list (int),list (int) -> list(int) For example, a call to get_common_elems([5,1,4,3,6],[6,1,8,3]) will return the list 1, 3, 6. Hint: Think about how you can make use of the in operator. You only need to iterate over one of the lists.
Computers and Technology
1 answer:
zaharov [31]3 years ago
3 0

Answer:

def get_common_elems(lst1, lst2):

   common_list = []

   for e in lst1:

       if e in lst2:

           common_list.append(e)

   return common_list

Explanation:

Create a function called get_common_elems that takes two lists, lst1, and lst2

Inside the function:

Create an empty list to hold the common elements

Initialize a for loop that iterates through the lst1.

If an element in lst1 is also in the lst2, append that element to the common_list

When the loop is done, return the common_list

You might be interested in
The type of human hair wig that is the most costly is:
RSB [31]

Answer: india

Explanation:

5 0
4 years ago
Using selection sort, how many times longer will sorting a list of 40 elements take compared to a list of 5 elements
Hoochie [10]

It will take 8 times more time to sort a 40-element list compared to the time spent on a 5-element list.

We can arrive at this answer as follows:

  • We can see that if we divide a group of 40 elements into groups containing 5 elements, we will have 8 groups.
  • In this case, the time it would take to sort the list of one group of 5 elements would be repeated 8 times so that we could sort all the groups and their elements.

Another way to do this is to divide the number 40 by 5. We would have the number 8 as a result, which indicates that we would need 8 times more time to sort a list of 40 elements, compared to a list of 5 elements.

You can get more information about lists at this link:

brainly.com/question/4757050

5 0
3 years ago
A brown outline around a frame is an indication of which tool?​
zimovet [89]

Answer:

Direct Selection Tool

Explanation:

The Direct Selection tool is a tool that allows the selection of a single object or a single path such that an object already grouped with other objects can be directly and moved to a desired location

The Direct Selection tool can be used to select a container's content including graphics which are imported and specific points or paths of a figure or text to allow for drawing, text editing or to edit paths.

6 0
3 years ago
Today's Apple Mac computers run with the same I-Ternal hardware as the Windows based PC true or false
Ksivusya [100]
Kinda of both. The processor, memory, hard drive and displays are all standard components and are provided by a variety computer competent manufacturers (except for the processors which are all supplied by Intel). Yet - while many components are standard - NO, the core, hardware components, like logic boards (motherboard), video cards, and other specialty components (some display connectors and displays, for example) are propriety Apple designs.
5 0
3 years ago
Write a program that computes the sum of the first tenpositive integers, 1 + 2 + ..+ 10.
Stella [2.4K]

Answer:

#include <iostream>  

using namespace std;

int main()

{

  int sum=0;//taking an integer variable to store the sum with initial value 0..

  for(int i=1;i<=10;i++)//looping from 1 to 10..

  {

      sum+=i;//adding each i in the sum..

  }

  cout<<sum<<endl;//printing the sum..

   return 0;

}

Explanation:

output :- 55

1.I have taken an integer variable sum which is equal to 0.

2.Looping over first ten positive integers.

3.Adding every number to sum.

4.Printing the sum.

6 0
3 years ago
Other questions:
  • Given the lists list1 and list2 that are of the same length, create a new list consisting of the last element of list1 followed
    13·1 answer
  • Create pseudocode that could be used as a blueprint for a program that would do the following: An employer wants you to create a
    12·1 answer
  • A typical item in a plan of procedure includes the name of the part of the ______ to
    5·1 answer
  • What is the term used to describe a computer system that can store literary documents, link them according to logical relationsh
    5·1 answer
  • What is an insertion point?
    6·1 answer
  • Function of pons for class 7​
    15·1 answer
  • Excel creates which type of cell references in formulas by default?
    5·1 answer
  • What is a presentation program? Name any<br> presentation programs.
    10·1 answer
  • Terri brought a magazine for $5, and 2 bottles of nail polish. Write an expression to represent the total amount she spent. Then
    5·1 answer
  • How does the dns help the world wide web scale so that billions of users can access billions of web pages?.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!