Computer Science, asked by siri6272, 1 year ago

Python program to find Intersection of two lists?

Answers

Answered by abhirowdy
0

Intersection of two list means we need to take all those elements which are common to both of the initial lists and store them into another list. Now there are various ways in Python, through which we can perform the Intersection of the lists.

Is it helpfull.

Answered by fiercespartan
0

Hey there!

It's quite simple if you give it a thought :)

Let's say there are two lists:

list1 = [1,2,3,4,5]

list2 = [5,4,6,7,8,9]

Now, all we have to do is find the common numbers/characters in both the lists.

Alright! here we go:

for x in list1:

 if x in list2:

   print(x)

Hope my answer helps! :)

Similar questions