Lecture

Coding Quiz - Finding Index of Target Value Using Sequential Search

In this coding quiz, you are tasked with writing a function that uses Sequential Search to find a specific element within a list and returns the index of that element.

If the target value is not present in the list, return -1.


Write Your Code Here
def solution(array, target): # Write your code here return



Constraints

  • The array parameter is a list of integers.

  • Assume that the array parameter is not sorted.

  • The target parameter is an integer value.




Example Input and Output

  • Input: numbers = [5, 3, 7, 1, 9], target = 7

  • Output: 2


  • Input: numbers = [10, 22, 35, 4, 5], target = 4

  • Output: 3

Lecture

AI Tutor

Publish

Design

Upload

Notes

Favorites

Help