Skip to main content
Practice

coding-quiz-1

---
id: coding-quiz-1
title: Coding Quiz - Finding Index of Target Value Using Sequential Search
description: Write a function to find a specific element in a list using a sequential search.
tags:
- Coding Quiz
- Sequential Search
- Python
sidebar_position: 2
isPublic: false
---

# 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`.

<br />

```python title="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

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.