This article will explain two different ways to write a python program to print all the letters or alphabets from a to z in lower case.
[the_ad id=”651″] Method 1: Using string module
Python string module has a variable named ascii_lowecase which is a string of all alphabets from a to z in lower case.
Iterating over this string using a for-in loop will return a letter one by one. Example,

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
import string
for char in string.ascii_lowercase:
print(char, end=' ')
import string for char in string.ascii_lowercase: print(char, end=' ')
import string

for char in string.ascii_lowercase:
     print(char, end=' ')

Output is

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

[the_ad id=”656″] Method 2: Using chr() function
ASCII values of lower case letters range from 97 to 123 where 97 is the value for ‘a’ and 123 is for ‘z’.
This integer when supplied to chr() function, it returns the string of one character corresponding to the integer.

Thus, if we iterate from 97 to 123 using a for loop, we can get the letters from a to z as shown below.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
for char in range(97, 123):
print(chr(char), end=' ')
for char in range(97, 123): print(chr(char), end=' ')
for char in range(97, 123):
     print(chr(char), end=' ')

If you need to write a program without using any python module, then this is the right answer.
Output is

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

[the_ad id=”644″] Hit the clap below if this was useful.