How to search and count the common values between a simple list and a two dimensional list? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to search and count the common values between a simple list and a two dimensional list?

A = [2,7,85,4] B = [[1,33,6],[3,5,7,6],[1,85,77]] The idea is to see which numbers are common in those two lists and how many. Flattening is not an option, each sublist in B should have a separate result when u run the code.

8th Feb 2022, 7:39 PM
Lenoname
3 Answers
0
Show your code
8th Feb 2022, 8:06 PM
Slick
Slick - avatar
0
Slick nice, but i wanted to print how MANY common values each sublist has in common. Something like: L2[0]= 0 L2[1]=2 L2[2]=1
9th Feb 2022, 5:28 AM
Lenoname