Find Item in List
Find Item in List
Tags: Data Structures Basics
Credit: CodingChallenge
Difficulty: Beginner
Type: Text
Category: Practice
Time Allowed: 5 s
Description:
Write a function that takes a list and a value, and returns True
if the value is in the list, or False
otherwise. This problem is designed to help you practice searching for items in lists
. The function should accept two parameters and return a boolean value.
Constraints:
- The first input will be a
list
of elements. - The second input can be any data type that may be in the list.
- The function should
return
aboolean
value:True
orFalse
.
Example:
- Input:
[1, 2, 3, 4, 5], 3
- Output:
True
Test Case | Input | Expected Output |
---|---|---|
1 | [[1, 2, 3, 4, 5], 3] | True |
2 | [['a', 'b', 'c'], 'd'] | False |
3 | [[], 1] | False |
4 | [[True, False], False] | True |
5 | [[1, 2, 3], 4] | False |
6 | [['apple', 'banana'], 'banana'] | True |
7 | [[1, 2, 3], 1] | True |
Leave a Comment
Please login to leave a comment.