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
Pie
3 years ago
12

Given the lists, lst1 and lst2, create a new sorted list consisting of all the elements of lst1 that also appears in lst2. For e

xample, if lst1 is [4, 3, 2, 6, 2] and lst2 is [1, 2, 4], then the new list would be [2, 2, 4]. Note that duplicate elements in lst1 that appear in lst2 are also duplicated in the new list. Associate the new list with the variable new_list, and don't forget to sort the new list.
Mathematics
1 answer:
aalyn [17]3 years ago
8 0

Answer:

lst1 = [4, 3, 2, 6, 2]

lst2 = [1, 2, 4]

new_lst =  []

for i in lst1:

      if i in lst2:

           new_lst.append(i)

new_lst.sort()

print(new_lst)

Step-by-step explanation:

The code is written in python.

lst1 = [4, 3, 2, 6, 2]

The variable lst1 represent a list of integers.

lst2 = [1, 2, 4]

The variable lst2 represent a list of integers.

new_lst =  []

An empty variable is created new_lst and it is used to store the values of lst1 that is in lst2.

for i in lst1:

The code loop through integers in lst1.

if i in lst2:

This code means if any of the value in lst1 is in lst2.

new_lst.append(i)

This code put the same values found in lst1 and lst2 in a new list(new_lst)

new_lst.sort()

We sort the value of the new list from the smallest to the biggest.

print(new_lst)

The new list is displayed

You might be interested in
Please need help on this thank you all
Brrunno [24]
Well y= 25 mins

2/5= 5 mins, x=2

so the answer is a
8 0
3 years ago
Do anybody want to talk
MrRa [10]

Answer:Nooooooope

Step-by-step explanation:

Feeling sleepy...

Good night dear..

8 0
3 years ago
Read 2 more answers
Chuck mixes 0.42 ounces of plant food and 2 gallons of water in a watering can. "
Andrej [43]

Answer:

0.06

Step-by-step explanation:

0.42 ounces is enough for 14 plants.  After watering 12 plants, there will be enough plant food left over for 2 plants.  Write a proportion:

0.42 / 14 = x / 2

Cross multiply:

14x = 0.84

Solve:

x = 0.06

4 0
3 years ago
Is -12 a rational number?
nata0808 [166]

-12 is a rational number becuase it can be written as a fraction (-12/1)

6 0
3 years ago
Read 2 more answers
Number of Green Candies in a Bag A dot plot going from 10 to 15. 10 has 1 dot, 11 has 3 dots, 12 has 1 dot, 13 has 2 dots, 14 ha
Inessa05 [86]

Answer:11

Step-by-step explanation:

Look at middle of pot line

6 0
3 years ago
Read 2 more answers
Other questions:
  • Lydia received her salary on Friday. She spent one-half of her salary on rent and then spent $168 on her electric and water bill
    6·1 answer
  • one pan pizza and two beef burritos provide 3570 calories. Two pan pizzas and one beef burrito provide 3450 calories. Find the c
    8·1 answer
  • The admission fee at an amusement park is $2.50 for children and $5.20 for adults. On a certain day, 264 people entered the park
    14·1 answer
  • Kareem wants to find the number of hours the average sixth-grader at his school practices an instrument each week. Which is the
    7·1 answer
  • Really suck on this someone pls help:(
    11·1 answer
  • Please help!!!!!!
    11·1 answer
  • Solve for x: 14-x= 5
    5·2 answers
  • What is the first step to solving this?<br> <img src="https://tex.z-dn.net/?f=%5Csqrt%7Bx-4%7D%3D7" id="TexFormula1" title="\sqr
    10·1 answer
  • 5(-6+8)-(8+12)=<br> Hjhsk
    9·2 answers
  • Solve this using substitution:<br> 5x-y=-3<br> 6x+y=3
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!