Check if a Value Exists in a List Using Python (Simple Lookup Check Validation)

preview_player
Показать описание
Check if a Value Exists in a List Using Python (Simple Lookup Check Validation)

Greetings, today we are going to look at how to do a lookup check in Python. A lookup check is a code check validation tequnique. We will be checking if a certain value is in an array/list.

This can be useful for situations where there are certain inputs you want from the user, such as a City or a day of the week. There are a finite amount of valid inputs for these values.

We can check if a value/element is in a list by using the 'in' keyword. This saves us from having to loop through each element of the list and checking for a match.

This checking if a value exists using Python tutorial will also work for other data types. If your array/list has duplicate values, the match will be found on the 1st instance of the duplicate value.

Thanks for watching this validation tutorial on how to do a lookup check on a list using Python.

Check if a Value Exists in a List Using Python (Simple Lookup Check Validation)
Рекомендации по теме