What is the meaning of this in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What is the meaning of this in python?

print(ord('s')) #ouput=115 print(chr(5)) #ouput=| what is chr and ord in python.please tell me.

23rd Apr 2018, 4:30 PM
Maninder $ingh
Maninder $ingh - avatar
2 Answers
+ 4
ord changing int to char using ASCII coding. chr is reverse operation of ord - it is changing char to ASCII code.
23rd Apr 2018, 4:42 PM
Bartosz Pieszko
Bartosz Pieszko - avatar
+ 1
ord is a built-in function that takes a char as argument and returns its range in the ASCII, chr is the inverse of ord it returns a char representation of a given int
24th Apr 2018, 8:31 PM
HBhZ_C
HBhZ_C - avatar