You are on page 1of 3

Department of Information Technology

Semester S.E. Semester IV – INFT

Subject Python Programming Lab (SBL)

Laboratory Shruti Agrawal


Teacher:

Laboratory -

Student Name Audumbar Gutte

Roll Number 21101B0016

Grade and
Subject Teacher’s
Signature

Experiment 06
Number

Problem Write a python program to search an element in 1D Array.


Statement

Resources / Hardware: Desktop/Laptop Software: Google Colaboratory


Apparatus
Required

Code:
import array as arr
found=0
count=0
sizeo = int(input("Enter number of elements of your
array : "))
a=arr.array('i',[])
while(sizeo > 0):
enter = int(input())
a.append(enter)
sizeo = sizeo -1
b = int(input("Enter element to be searched : "))
for i in a:
count+=1
if b == i:
found=1
break

if found == 1:
print("Element found at",count,"position")
else:
print("Element not found")
Output:

You might also like