Someone to explain to me the ord() function in Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Someone to explain to me the ord() function in Python

How the ord() is used to convert a character to its Unicode value

15th May 2020, 2:19 PM
Tosh
Tosh - avatar
4 Answers
+ 3
The code is here ```print(ord('a')) print(ord('0'))```
15th May 2020, 2:46 PM
Tosh
Tosh - avatar
+ 3
The ord() function will give you the ascii code or unicode point of a character. it is an integer number. ord('a') -> 97 ord('1') -> 49
15th May 2020, 2:47 PM
Lothar
Lothar - avatar
+ 1
ord() returns ASCII of an character. ord(a) returns 97. You can find ASCII tables online, here is one of them: https://images.app.goo.gl/gJ6mygY2gegBtBsz7
15th May 2020, 2:50 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
Meaning all characters have their unique value
15th May 2020, 2:51 PM
Tosh
Tosh - avatar