Program - function to return mirir charcters of a letter.


Topic: Program - function to return mirir charcters of a letter.

Solution

def mirror_character(word: str, value: int):
    import string
    letters = string.ascii_lowercase
    rev_letter = letters[::-1]
    dict_char = dict(zip(letters, rev_letter))
    final_1 = word[0:value]
    final_2 = []
    for i in range(value, len(word)):
        final_2.append(dict_char[word[i]])
    print(final_1+''.join(final_2))



List all Python Programs