ord python

Solutions on MaxInterview for ord python by the best coders in the world

showing results for - "ord python"
Matthew
14 Sep 2016
1'''note the integer representation of unicode character 
2of capital letters and small letters are completely different'''
3
4# example
5print( ord('A') ) # output 65
6print( ord('a') ) # output 97
Emilio
14 Oct 2019
1# ord('a') means 'get unicode of a'
2ord('a') = 97
3
4# chr(97) is the reverse, and means 'get ascii of 97'
5chr(97) = 'a'
6
7# to get the int val of a single digit represented as a char, do the following:
8# ord(single_digit_char) - ord('0') = single_digit_int
9ord('5') - ord('0') = 5
10ord('3') - ord('0') = 3
11
Lola
21 Mar 2018
1print('Unicode value of lower case alphabet a is ', ord('a')) # lower case alphabet 
2print('Unicode value of bumber 5 is ', ord('5')) # Number
3print('Unicode value of symobol $ is ', ord('$')) # dollar
4print('Unicode value of upper case alphabet A is ', ord('A')) # Upper case alphabet
5print('Unicode value of zero is ', ord('0')) # Number Zero
6
Sanjay
20 Jan 2019
1print(chr(97))
2print(ord('a'))
Mateo
02 Jun 2020
1#Find position in alphabet
2ord('a') - 96
3Output: 1