Here, we will figure out how to print them all capitalized and lowercase letters in order in Python programming language?
To carry out this responsibility, we will utilize the ideas of ASCII esteem. ASCII represents the American Standards Code for Information trade. It gives us a numerical incentive to the portrayal of characters. The ASCII estimation of capitalized letters and lowercase letter sets start from 65 to 90 and 97-122 individually. Prior to going to tackle this issue, we will gain proficiency with a smidgen about how to change over the numerical incentive to characters and the other way around.
Convert character to numerical worth:
In Python, a capacity ord() is utilized to change over the characters into a numerical worth. This is an inbuilt capacity. We should see the program,
# input a number
s=input('Enter the character: ')
# getting its ascii value
n=str(ord(s))
# printing the result
print('ASCII of character {} is {}.'.format(s,n))
Output:
Enter the character: M
ASCII of character M is 77.
Convert numerical incentive to character:
In Python, a capacity chr() is utilized to change over a numerical incentive into character. This is an inbuilt capacity. How about we see the program,
# input a number i.e. ascii code
n=int(input('Enter the numerical value: '))
# getting its character value
s=chr(n)
# printing the result
print('The character value of {} is {}.'.format(s,str(n)))
Output:
Enter the numerical value: 77
The character value of M is 77.
Presently we have figured out how to change over the numerical incentive into character and by utilizing its ideas we will effectively tackle the above issue by utilizing the Python language.
Python program to print the all capitalized and lowercase letters in order:
# printing all uppercase alphabets
print("Uppercase Alphabets are:")
for i in range(65,91):
''' to print alphabets with seperation of space.'''
print(chr(i),end=' ')
# printing all lowercase alphabets
print("\nLowercase Alphabets are:")
for j in range(97,123):
print(chr(j),end=' ')
Output:
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