Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q 2 . Write a program that defines two lists as variables and computes the intersection of these two lists ( i . e .

Q2. Write a program that defines two lists as variables and computes the intersection of these
two lists (i.e., a list of elements that are common to both lists).
Run the following test cases and make sure your results are correct:
Ist1=[1,3,5], Ist2=[5,3,1] The output should be 1,3,5
Ist1=[1,3,6,9], lst2=[10,14,3,72,9] The output should be 3,9
Ist1=[2,3], Ist2=[3,3,3,2,10] The output should be 3,2
Ist1=[2,4,6], Ist2=[1,3,5] The output should be []
N.B.: The order of your outputs does not matter 3,2 is the same as 2,3
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

3 43 +4 1 3 1 0.00 Round to two decimal places.

Answered: 1 week ago

Question

Draw a schematic diagram of I.C. engines and name the parts.

Answered: 1 week ago

Question

Explain the importance of nonverbal messages.

Answered: 1 week ago

Question

Describe the advantages of effective listening.

Answered: 1 week ago

Question

Prepare an employment application.

Answered: 1 week ago