Start learning free

LESSON 160 OF 673 · LOOPS & CONDITIONALS

Array Contains

Practice

Given an array of integers nums and another integer value, check if value occurs in nums.

If the value occurs in nums, return True; otherwise return False.


Examples:

contains([1, 2, 4, 5], 4) -> True

contains([-1, 2, -4, 0, 10], 7) -> False

Note:

Do not use builtin functions such as the in operator, it would defy the whole purpose of the challenge. Write the whole code yourself.

STEP 1 OF 3
    Ctrl + Enter to check