1. Name of Students Omkar Rane
Roll No D422
Batch D1
Experiment No EX-5-1
Title of Experiment
Select the number from the entered list and find its
position in python (use linear search)
Write an Algorithm:
STEP I: Start
Step 2: 'Enter n number of element:’
Step 3: for in range(n):
Element="Enter element of list:"
list. Append(element)
Step 4: Display ("given list is:"), list
p=0
Step 5: x="Enter number to find:"
Display "number to find is:”, x
Step 6: for c in list:
if c==x:
print"number is found"
index=list.index(x)
Display "Index value is:",index
p=1
Step 7: if (p==0):
Display "number is not found"
Step 8: stop
Flow Chart:
2. Paste Your Python Program ( Python Code):
list=[] # define empty list
n=input('Enter number of element:')
for in range(n): # define range
element=input("Enter element of list:")
list.append(element)
print("given list is:"),list
p=0
x=input("Enter number to find:")
print"number to find is:",x
for c in list:
if c==x:
print"number is found"
index=list.index(x)
print"Index value is:",index # displaying index value
p=1
if (p==0):
print"number is not found"
Paste Your Program OUTPUT :
given list is: [25, 15, 65, 45, 85]
number to find is: 65
number is found
Index value is: 2
3. given list is: [25, 35, 65, 15, 45]
number to find is: 88
number is not found