# Searching Algorithm
# LINEAR SEARCH
# given an array of elements not in the ordered manner,search a given KEY is present or not....
a = list()                                                   # define a variable as list(array)
flag = 0                                                     # declaring flag value to '0'
n = int(input("enter the no of elements"))                   # Getting limit(array length) from user..
for i in range(n):
    m = int(input("enter the element"))
    a.append(m)                                              # appending each element to the array 'a'
print(a)
key = int(input("enter the search key :"))                   # Getting the search key from the user..
for i in range(n):                                           # searching for the element
    if a[i] == key:
        flag = 1
        j = i
        break
if flag == 1:
    print("the element is found at position ", j+1)          # printing the result...
else:
    print("the element is not found")


d6356074cf5ba48d8a8a07c33fbb5b47a84c2237
<mask token>

<mask token>
for i in range(n):
    m = int(input('enter the element'))
    a.append(m)
print(a)
<mask token>
for i in range(n):
    if a[i] == key:
        flag = 1
        j = i
        break
if flag == 1:
    print('the element is found at position ', j + 1)
else:
    print('the element is not found')

a = list()
flag = 0
n = int(input('enter the no of elements'))
for i in range(n):
    m = int(input('enter the element'))
    a.append(m)
print(a)
key = int(input('enter the search key :'))
for i in range(n):
    if a[i] == key:
        flag = 1
        j = i
        break
if flag == 1:
    print('the element is found at position ', j + 1)
else:
    print('the element is not found')

# Searching Algorithm
# LINEAR SEARCH
# given an array of elements not in the ordered manner,search a given KEY is present or not....
a = list()                                                   # define a variable as list(array)
flag = 0                                                     # declaring flag value to '0'
n = int(input("enter the no of elements"))                   # Getting limit(array length) from user..
for i in range(n):
    m = int(input("enter the element"))
    a.append(m)                                              # appending each element to the array 'a'
print(a)
key = int(input("enter the search key :"))                   # Getting the search key from the user..
for i in range(n):                                           # searching for the element
    if a[i] == key:
        flag = 1
        j = i
        break
if flag == 1:
    print("the element is found at position ", j+1)          # printing the result...
else:
    print("the element is not found")

