Python Alphabet | Ways to Initialize a List of the Alphabet

Sometimes while working with the alphabet in python, to make our task easy, we want to initialize a list containing all the alphabets. If we do not know how to do it using python, we will manually type all the alphabets, which will be quite a time taking. In this article, we will learn many different ways of initializing a list containing the alphabets in uppercase, lowercase, in both uppercase and lowercase. We will also learn how to do various operations on alphabets.
Python Alphabets are the same as the lower-level C programming language. They have a unique ASCII value attached to them. With the help of these ascii values, you can convert them into characters and numbers. In this post, we’ll go through all the ways to create a list of alphabets.
In every programming language, including python, every alphabet has a unique ASCII value. We can convert those ASCII values into alphabets using chr and ord functions.
Generating a list of Alphabets in Python
There are many ways to initialize a list containing alphabets, and we will start with the naïve way.
General Approach for Python Alphabet
The ASCII value of A-Z lies in the range of 65-90, and the for a-z, the value is in the range 97 – 122. What we will do is that we will run the loop in this range and using chr(), we will convert these ASCII values into alphabets.
A-Z:

a-z:
Python Alphabet using list comprehension
We can initialize the variable with either ‘a’ or ‘A’ and keep incrementing the ASCII value of the variable. We will run the loop 26 times as there are 26 alphabets in the English language.
Python Alphabet using map function
We can also use the map function to produce the list of alphabets, let’s see how.
Importing the String Module
We can also import the string module, and use its functions to make a list of alphabets without any hassle.
How to check if the character is Alphabet or not in Python
If we want to check if the character is an alphabet or not, we can use the if condition or the built-in function. Let’s see how.
Using If Condition
Using built-in function
We can also use the isalpha() method to check whether the character is an alphabet or not.
How to Convert alphabet into ASCII value
Let us see how we can convert alphabets into their respective ASCII values.
Must Read:
Conclusion
Generally in dynamic programming or while making any application, we need to initialize a Python list containing the alphabets. There are a variety of ways using we can make a list containing all the alphabets like using the string module or by using the ASCII values.
Try to run the programs on your side and let us know if you have any queries.
List of Alphabets Python
Here we develop a program to print the list of alphabets in Python. An alphabet is a set of letters or symbols in a fixed order used to represent the basic set of speech sounds of a language, especially the set of letters from A to Z. We will develop a Python program to initialize the list with the English alphabets a-z using various methods.
Alphabet list Python
This python program using the For Loop to print the list of uppercase and lowercase alphabets. The most general method that comes to our mind is using the brute force method of running a loop till 26 and incrementing it while appending the letters in the list. The ord() method is used to find the Unicode value of a character passed as its argument. The chr() method returns a character (a string) from an integer (represents Unicode code point of the character).
Please enable JavaScript
Uppercase Alphabets: [‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’, ‘N’, ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’]
Lowercase Alphabets: [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’, ‘m’, ‘n’, ‘o’, ‘p’, ‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’]
Python Alphabet List
This method is similar to the above method, but rather a shorthand method. In this program, we use the list comprehension technique.
Uppercase Alphabets: [‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’, ‘N’, ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’]
Lowercase Alphabets: [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’, ‘m’, ‘n’, ‘o’, ‘p’, ‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’]
Alphabet list in Python
The map() function applies a given function to each item of an iterable (list, tuple, etc.) and returns a list of the results. It typecasts the numbers in a range to a particular data type, char in this case, and assigns to the list.
Uppercase Alphabets: [‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’, ‘N’, ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’]
Lowercase Alphabets: [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’, ‘m’, ‘n’, ‘o’, ‘p’, ‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’]
Print list from a to z
This python program also performs the same task but in a different way. In this program, we are using the built-in function to print the list of alphabets. The string.ascii_uppercase method returns all uppercase alphabets and string.ascii_lowercase method returns all lowercase alphabets.
Uppercase Alphabets: [‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’, ‘N’, ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’]
Lowercase Alphabets: [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’, ‘m’, ‘n’, ‘o’, ‘p’, ‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’]
Order List Alphabetically
In the previous program, we used string.ascii_uppercase and string.ascii_lowercase but in this program, we are using string.ascii_letters method. This method returns all lowercase and uppercase alphabets as a single string.
Alphabets: [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’, ‘m’, ‘n’, ‘o’, ‘p’, ‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’, ‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’, ‘N’, ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’]
If you enjoyed this post, share it with your friends. Do you want to share more information about the topic discussed above or do you find anything incorrect? Let us know in the comments. Thank you!
How to create a list of English alphabet letters (from A to Z) with python ?
Examples of how to create a list of English alphabet letters (from A to Z) with python:
Table of contents
List of alphabet letters (lowercase)
To get a list of English alphabet letters with python, a straightforward solution is to use the library called string
Then to transform the above string to a list, just use the list() function:
Note: if you want to upper case a given letter, b for instance:
a solution is to use the method upper():
List of alphabet letters in (uppercase)
To create a list of alphabet letters in uppercase, we can use a list comprehension:
or directly from the library sring:
then create a list using list() method:
Note: same to transform a given letter from uppercase to lowercase
List of lowercase and uppercase alphabet letters
Example of application: create a simple coded message
Create a list of alphabet letters
Rotate elements of the previous list
Create a secret dictionary
and a function to encode a word:
Now let’s encode the word ‘Hello’:
Author 
Benjamin
Greetings, I am Ben! I completed my PhD in Atmospheric Science from the University of Lille, France. Subsequently, for 12 years I was employed at NASA as a Research Scientist focusing on Earth remote sensing. Presently, I work with NOAA concentrating on satellite-based Active Fire detection. Python, Machine Learning and Open Science are special areas of interest to me. ORCID
Get List of Letters in Alphabet with Python
To create a list of the letters of the alphabet in Python, the easiest way is to use the string module and access the pre-defined string constants ascii_lowercase, ascii_uppercase, or ascii_letters.
You can also use the chr() function to get a list of letters from their integer representation.
When working in Python, there are many great pre-defined constants that we can use so we don’t need to reinvent the wheel every time we want to create a new application or piece of code.
One example is a list of the letters of the alphabet.
To create a list of the alphabet in Python, you can use the string module pre-defined string constants ascii_lowercase, ascii_uppercase, or ascii_letters.
ascii_lowercase contains the letters of the alphabet and they are all lowercase, while ascii_uppercase has all of the letters but uppercase.
ascii_letters is the combination of ascii_lowercase and ascii_uppercase.
Below shows how you can use the string module pre-defined string constants ascii_lowercase, ascii_uppercase, and ascii_letters to create the alphabet in Python.
Using chr() Function to Create Alphabet in a For Loop
Another way to create the alphabet in Python is with the chr() function. chr() converts an integer to a Unicode character.
The lowercase letters are represented by the integers 97 to 122. Therefore, we can create a loop that loops over 97 to 122 and create the alphabet with the help of chr().
Below is an example of how you can create a list of the letters of the alphabet with chr() and a loop in Python.
Hopefully this article has been useful for you to learn how to create a list of letters and create the alphabet in a list variable in Python.
Other Articles You'll Also Like:
- 1. pandas Standard Deviation – Using std() to Find Standard Deviation
- 2. Count Number of Files in Directory with Python
- 3. Get Last Character in String in Python
- 4. Get Day Name from Datetime in pandas DataFrame
- 5. Get Python Dictionary Keys as List
- 6. Difference Between // and / When Dividing Numbers in Python
- 7. How to Read Excel File from AWS S3 Bucket Using Python
- 8. Check if pandas DataFrame is Empty in Python
- 9. Python acos – Find Arccosine and Inverse Cosine of Number
- 10. List of Turtle Shapes in Python
About The Programming Expert

The Programming Expert is a compilation of a programmer’s findings in the world of software development, website creation, and automation of processes.
Programming allows us to create amazing applications which make our work more efficient, repeatable and accurate.
At the end of the day, we want to be able to just push a button and let the code do it’s magic.