Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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:
lst1=[1,3,5], lst2=[5,3,1] The output should be [1,3,5]
lst1=[1,3,6,9], lst2=[10,14,3,72,9] The output should be [3,9]
lst1=[2,3], lst2=[3,3,3,2,10] The output should be [3,2]
lst1=[2,4,6], lst2=[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

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

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

Students also viewed these Databases questions