Python chr() function

Published February 15, 2022

"chr" stands for “characters” in most programming languages. Chr() is a Python built-in function that converts an integer into a character. This function accepts a number as an input, with a range of 0 to 1,1141,111 to output characters.

 

Syntax

Here is the syntax for implementing chr() function in python

Chr(num)

Where num is the value of the integer to be converted into characters

Example

In this example, we are going to convert integers to display the word "Python."

print(

chr(112),

chr(121),

chr(116),

chr(72),

chr(111),

chr(110)

      )

 

Output

p y t H o n

 

Article Contributed By :
https://www.rrtutors.com/site_assets/profile/assets/img/avataaars.svg

286 Views