๐Ÿ
B.TECH I YEAR โ€ข II SEMESTER โ€ข R25

Python Programming - Lab Manual

Python Programming Laboratory โ€ข Program Solution

๐Ÿ“˜ R25 Regulation ๐ŸŽ“ I Year ๐Ÿ“š II Semester ๐Ÿ Python Programming ๐Ÿงช Lab Program
Selected Program

find common values between two arrays

โ† All Python Programs

Aim:

☛   Write a program to find common values between two arrays

Solution :


PROGRAM: (common_values.py)

 
import numpy as np
array1 = np . array ( [ 5, 10 , 20 , 40 , 60 ] )
print ( " Array1 : " , array1 )
array2 = np . array ( [10 , 30 , 40 ] )
print ( " Array2 : " , array2 )
print ( " Common values between two arrays are : " )
print ( np . intersect1d ( array1 , array2 ) )

OUTPUT:

 
Array1 : [ 5 10 20 40 60 ]
Array2 : [ 10 30 40 ]
Common values between two arrays are :
[ 10 40 ]


๐Ÿ’ป Run This Python Program

find common values between two arrays
The selected Python program is loaded automatically into the editor. Edit the program, provide input if required and click Run.

The compiler is embedded using OneCompiler. Your Python program runs inside the embedded Python environment; Study Glance does not execute Python code directly on your web server.
โ† Back to Python Lab Programs ๐Ÿ“š All Lab Manuals