How to Check If a Letter is in a List in Python

To be a proficient Python programmer, it’s crucial to master the basic operations such as checking if a specific letter is in a list. In this tutorial, we’ll learn how to check if a letter is in a list in Python.

Step 1: Understand the ‘in’ keyword in Python

Python has a built-in keyword called ‘in’, which is used to check if a value exists in a list, string, tuple, etc. When used with a list, the ‘in’ keyword checks if a specific value is available in the list. If the value is available, it returns True; otherwise, it returns False.

Step 2: Initializing a list of letters

To use ‘in’, we first need to initialize a list. This will be our reference list for checking a specific letter. Here is an example:

Step 3: Checking for a letter

Now that our list has been created, let’s see how we can check for a specific letter. If we want to check if the letter ‘a’ is in the list, we can do it like this:

If ‘a’ is in the list, this code will output: ‘a is in the list‘. Otherwise, it will print: ‘a is not in the list‘.

Full Code

Now that we’ve gone over each step, let’s put it all together:


Being able to check if an element exists in a list is a fundamental operation in any programming language, and Python makes it very simple and straightforward with the ‘in’ keyword. This basic concept is also applicable to other data types such as strings and tuples.

Python’s simplicity and readability make it a great language for beginners, and its versatility and powerful libraries make it a favorite among professionals. Continue practicing and exploring more about Python to unlock its full potential.