Page 75 - PYTHON-12
P. 75

#-------------------------------------------------------------------------------------------------------------------------
               ----------------


               def print_array():

                   for i in range(0,10):


                       print(arr[i]),

               #-------------------------------------------------------------------------------------------------------------------------
               ----------------

               def reverse_array():


                   for i in range(1,11):

                       print(arr[-i]),

               #-------------------------------------------------------------------------------------------------------------------------
               ----------------


               def lsearch():

                   try:

                       x=int(input('Enter the Number You want to search : '))


                       n=arr.index(x)

                       print ('Number Found at %d location'% (i+1))


                   except:

                       print('Number Not Exist in list')

               #-------------------------------------------------------------------------------------------------------------------------
               ----------------


               def linear_search():

                   x=int(input('Enter the Number you want to search : '))


                   fl=0

                   for i in range(0,10):

                       if arr[i]==x :


                           fl=1
   70   71   72   73   74   75   76   77   78   79   80