Check if a Value Exists in an Array (For Loop v.s Recursion)

preview_player
Показать описание
In this video, I will show you how to check if a value or an element exists in an array or list using a for loop and then recursion in a Python program. This is also known as list membership, where we find if the element is in an array or list.

What is recursion? Recursion is a function that calls upon itself. Here, we write a function that calls upon itself and to find if an element is in an array using recursion. While it is easy to use a for loop or while loop to do this, it is important that you understand these recursion steps to have a strong foundation to learn more complex recursive algorithm in the future.

In the next video, I will show you how to get the index of an element in an array. For example, get([a,b,c], 2) will return c since the content at index 2 is c.

LIKE & SUBSCRIBE:
Рекомендации по теме
Комментарии
Автор

Wowwww the best explanation for the problem statement I was searching for....Hope u get more views..Tqsmm

littlestarter_