Find Common Elements Using np.intersect1d()
📖 Scenario: Imagine you have two lists of favorite fruits from two friends. You want to find which fruits both friends like.
🎯 Goal: Build a small program that finds the common fruits between two lists using np.intersect1d().
📋 What You'll Learn
Create two numpy arrays with exact fruit names
Use a variable to store the common fruits
Use
np.intersect1d() to find the intersectionPrint the common fruits array
💡 Why This Matters
🌍 Real World
Finding common items between lists is useful in surveys, recommendations, and data comparison tasks.
💼 Career
Data scientists often need to compare datasets to find overlaps or shared features.
Progress0 / 4 steps