The document describes a function called convert_char that takes a sentence as input and returns a modified sentence by shifting lowercase letters down 3 positions in the ASCII table, uppercase letters up 3 positions, and replacing non-alphanumeric characters with #. It provides hints to use ord(), chr(), islower(), isupper(), and isalnum() string methods. The goal is to write a program that takes a sentence as input and calls convert_char to output the modified sentence.
You should not use lists, tuples, dictionaries in your solution.Writ.pdf
1. You should not use lists, tuples, dictionaries in your solution.Write a Python script that converts
a given string using the key given below.
Write a function, convert_char, which takes a sentence and for each character in the sentence, if
the character is lowercase, it should be shifted down by 3 (according to its ascii value, if it is
uppercase, it should be shifted up by 3, and if it is non-alphanumeric it should be replaced with a
hash symbol (#).
Hint:
ord( ch ) returns the integer equivalent of a character and chr( val ) returns the character
equivalent for the given integer.
Consider using islower(), isupper() and isalnum() methods of string objects. These methods
return True or False after checking for the strings status of being lowercase, uppercase and
alphanumeric.
Write a program to take a sentence and output the modified sentence using the above function.
Sample Run: (Input is shown in red)