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
2 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]2 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
You are going to purchase a new iPhone for $479.99 and you have 2 coupons but can only use one. The first coupon is $100 off the
bonufazy [111]

Answer:100 off discount

Step-by-step explanation:

If you use the 20% discount you get only 95 dollars off the price

3 0
3 years ago
Whats the answer for number 3
Karolina [17]

cant see the full question ;/

5 0
3 years ago
Enter an equation to represent the amount of moneys, in dollars, in Jack's account after w weeks, in simplest terms.
BigorU [14]
A = account
M = money
w = weeks

A = Mw

Hope this helps! Any questions let me know :)
6 0
2 years ago
-3r +9 = -4r +5<br>what's r?​
-BARSIC- [3]

Answer:

-4

Step-by-step explanation:

-3r+9=-4r+5

-3r+4r=5-9

r=-4

8 0
3 years ago
Read 2 more answers
Djrigisbtifbebfj djjsbFiebdiwbdioc9sj
Zielflug [23.3K]

Answer:

dsjklejioslmßfejazkfjkejsklfjkfjljakfj ajkldjfkajkfdjakl

Step-by-step explanation:

8 0
3 years ago
Other questions:
  • PLEASE REALLY NEED HELP
    15·1 answer
  • Which of the following would be an acceptable first step in simplifying the expression (sinx)/(1 + sinx) ?
    8·2 answers
  • Suppose the 3 schools have succeeded in raising
    5·1 answer
  • Show work plz
    9·1 answer
  • Which ordered pair satisfies the equation y =(-5)? A.(-6,1) B. (-2,7) C.(2,-7) D.(-1,-6)​
    12·1 answer
  • Can a real number be both rational and irrational?
    13·1 answer
  • 8 pts
    5·1 answer
  • PLZ help HOMEWORK 100 ÷ 5 x 4 + 4 to the power of three
    13·2 answers
  • 51/68 in simplest form
    6·2 answers
  • Formulate a rational algebraic equation of the problem​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!