in Education by
search element 20 30 40 60 70 80 90 100 element in an array find the element 20 Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
def search(arr, item): for i in range(len(arr)): if arr[i] == item: return i return -1 nums = [20, 30, 40, 60, 70, 80, 90, 100] idx = search(nums, 20) print(f”item found at idx {idx}”) if idx > -1 else print(“item not found”)

Related questions

0 votes
    Finding covariance matrix in steps from the given below data. ABC = Math Physics English 90 80 40 90 60 80 60 50 70 30 40 70 30 20 90 Select the correct answer from above options...
asked Nov 28, 2021 in Education by JackTerrance
0 votes
    TOTAL PERCENTAGE GRADE 1 A 35 80 78 70 263 65.75 2 B 65 48 68 40 221 55.25 3 C 47 66 65 50 228 57 4 D 89 ... 8 H 69 78 67 67 281 70.25 Select the correct answer from above options...
asked Dec 12, 2021 in Education by JackTerrance
0 votes
0 votes
    write the steps to search the 13 from the following element using binary search 2,4,5,8,9,11,12,13,15,18,21,22,25,29,30 Select the correct answer from above options...
asked Dec 13, 2021 in Education by JackTerrance
0 votes
    write a program to print fibonacci series . write a program to search an element within the array using binary search Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
0 votes
    Consider a list2 with values 70,60,50. What will be the output statements considering that the above object has ... print(list2*3) Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
0 votes
    . 1. Find the output of the following programs. (a) 10 LET AS = “HELLO” 20 LET BS = “FRIENDS” 30 PRINT AS:BS 40 END Select the correct answer from above options...
asked Nov 29, 2021 in Education by JackTerrance
0 votes
    2 6 10 14 18 22 26 30 34 42 46 50 54 58 या च्या तुन तीन संख्या घेऊन उत्तर 60 आले पाहिजेत Select the correct answer from above options...
asked Dec 25, 2021 in Education by JackTerrance
0 votes
    In case of 100 students, 60 drink tea, 50 drink coffee and 30 think both tea and coffee A students of this ... only one of the drinks Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
0 votes
    Plz write a program for the following pattern in Java class 10 ICSE 2 6 12 20 30 42 4 6 8 10 12 2 2 2 ... spam. Answer only if you know Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    given the following series S1 and S2 820 b16 A60 b8ta 34b 74a 40b 90. write the command to find the product of series S1 and S2 Select the correct answer from above options...
asked Dec 15, 2021 in Education by JackTerrance
0 votes
    Considering the following sorted array and the search key as 89, what will be the sequence of keys in the array ... searching for 89? Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    Write a program to generate first 20 terms of Fibonacci series and store them in single dimension array. Display ... from the array Select the correct answer from above options...
asked Dec 10, 2021 in Education by JackTerrance
...