Page 292 - CTS - CSA TP - Volume 2
        P. 292
     COMPUTER SOFTWARE APPLICATION - CITS
           EXERCISE 132 :   Write a python program to use built in
                                         functions i.e. chr, cmp, compile, dir,
                                         eval, filter, hash, input, len, locals, long,
                                         max, pow, range, slice, tuple, Unicode,
                                         vars
            Objectives
           At the end of this exercise you shall be able to
           •  develop python programs  to use built in functions i.e. chr, cmp, compile, dir, eval, filter, hash, input, len,
              locals, long, max, pow, range, slice, tuple, Unicode, vars.
             Procedure
           TASK 1 :    Write  a  program  that  takes  an  integer  as  input  and  uses the  chr  function  to  print  the
                      corresponding ASCII character
           Code:
           # Exercise 1
           num = int(input(“Enter an integer: “))
           char = chr(num)
           print(“Corresponding ASCII character:”, char)
           Explanation:
           1  The program starts by prompting the user to enter an integer using input.
           2  The entered value is converted to an integer using int(num).
           3  The chr function is then used to convert the integer to its corresponding ASCII character.
           4  Finally, the result is printed, showing the ASCII character associated with the entered integer.
           Output:
                                                           277





