Python Program To Find ASCII value of a characterIn this tutorial, we will learn how to find the ASCII value of a character and display the result. ASCII: ASCII is an acronym that stands for American Standard Code for Information Interchange. A specific numerical value is given to different characters and symbols for computers to store and manipulate in ASCII. It is case sensitive. The same character, having different formats (upper case and lower case), has a different value. For example, The ASCII value of "A" is 65 while the ASCII value of "a" is 97. Example 1: Output: 1# Please enter a character: J The ASCII value of 'J' is 74 2# Please enter a character: $ The ASCII value of '$' is 36 In the above code, we have used the ord() function for converting a character into an integer, that is, ASCII value. This function is used to return the Unicode code point of the given character. Example 2: Output: Please enter the String: "JavaTpoint# " 34 J 74 a 97 v 118 a 97 T 84 p 112 o 111 i 105 n 110 t 116 # 35 Unicode is also an encoding technique which is used for getting the unique number of the character. Though ASCII can only encode 128 characters, whereas the current Unicode can encode more than 100,000 characters from hundreds of scripts. We can also convert the ASCII value into their corresponding character value. For that, we have to use the chr() in place of ord() in the above code. Example 3: Output: The character value of 'K' ASCII value is: The character value of 'J' ASCII value is: { The character value of 'R' ASCII value is: L ConclusionIn this tutorial, we have discussed how a user can convert character value into ASCII value and also how they can get the character value of the given ASCII value. Next TopicPython Make a Simple Calculator |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India