Python – ord() and chr() functions

Hi, these functions, for example , convert a letter into its corresponding ascii code and vice versa.

ord(A) –> give the value of 65

chr(65) –> would give “A”

Here is a sample code for printing the alphabet ­čÖé

start_character = "A"
end_character = "Z"
for i in range(ord(start_character),ord(end_character)+1):
    print(chr(i))

Leave a Reply

Your email address will not be published. Required fields are marked *