Codeforcoding

Python program to print all upper case and lower case Alphabets

Python program to print all upper case and lower case Alphabets

In this article, we will discuss the concept of the Python program to print all upper case and lower case Alphabets

In this post, we are going to learn how to print all uppercase and lowercase letters in Python programming language

Python program to print all upper case and lower case Alphabets
Print All Alphabets

Code to print all upper case and lower case Alphabets using string modules

In this program, we use the string function string.ascii_lowercase to print lowercase Alphabets and use string.ascii_uppercase function to print uppercase Alphabets. These functions are included in the string module in Python language

program 1

#display uppercase and lower case Alpabets using String modules
import string

#display lowercase Alphabets
print("Lowercase Alphabets are:")
for i in string.ascii_lowercase:
    print(i,end=" ")
print("\n")

#display uppercase Alphabets
print("Uppercase Alphabets are:")
for i in string.ascii_uppercase:
    print(i,end=" ")

When the above code is executed, it produces the following result

Uppercase Alphabets are:
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 are:
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

 

Code to print all upper case and lower case Alphabets using chr() function

The chr() function returns a Unicode character for the given ASCII value, hence chr(98) returns “b”

Program 2

#display uppercase and lower case Alpabets using chr() function

#display lowercase Alphabets
print("Lower Alphabets are:")
for i in range(97,123):
    print(chr(i),end=" ")
print("\n")

#display uppercase Alphabets
print("Uppercase Alphabets are:")
for i in range(65,91):
    print(chr(i),end=" ")
print("\n")

When the above code is executed, it produces the following result

Lower Alphabets are:
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

Uppercase Alphabets are:
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

 

 

Suggested for you

for loop in Python

Operator min Python

Data type in Python

 

Similar post

C program to print all upper case and lower case Alphabets

C++ program to print all upper case and lower case Alphabets

Java program to print all upper case and lower case Alphabets

 

C program to print all Alphabets using ASCII value

C++ program to print all  Alphabets using ASCII value

Java program to print all Alphabets using ASCII value

Python Program for count upper or lowercase letter of the given string
C program to Count the total number of characters in the given string including space
Exit mobile version