0% found this document useful (0 votes)
4 views3 pages

Python Program for 1D Array Search

The document outlines a Python programming lab experiment for semester IV students, focusing on searching for an element in a 1D array. It includes the code for the program, which prompts the user to input elements into an array and search for a specified element. The lab is supervised by teacher Shruti Agrawal and includes details about the required hardware and software.

Uploaded by

jnkn
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Python Program for 1D Array Search

The document outlines a Python programming lab experiment for semester IV students, focusing on searching for an element in a 1D array. It includes the code for the program, which prompts the user to input elements into an array and search for a specified element. The lab is supervised by teacher Shruti Agrawal and includes details about the required hardware and software.

Uploaded by

jnkn
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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=[Link]('i',[])
while(sizeo > 0):
enter = int(input())
[Link](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