Skip to content
Advertisement

Finding intersections between two lists

Edit: I was using Jupyter notebook, I had two different scripts in a row while working, The script shown here is one, and the error shown here is from the other script. (mistake) Thanks for your time! I intentionally learned more though.

I’m trying to find an intersection between 10000 randomly generated lists of 6 elements numbers between 1 to 49 and a single list that I wrote myself also 1 to 49…

I tried using def like in the following script:

JavaScript

but I get the following error:

JavaScript

Is there something I’m missing? I tried to look online but couldn’t find any solutions!

Advertisement

Answer

I changed list2 just to show that code is working you have some error in your code you can do something like that:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement