Create a program that replaces each letter in a message with its corresponding letter in a backwards version of the English alph | Sololearn: Learn to code for FREE!

0

Create a program that replaces each letter in a message with its corresponding letter in a backwards version of the English alph

How am I gonna go about it pls

5/8/2022 6:58:45 AM

Fortunate Oyeyemi

5 Answers

New Answer

+5

Fortunate Oyeyemi , besides the suggestions you already got, the task can be done also by using a dictionary. this has to be like: {'a': 'z', 'b': 'y', ..., 'z': 'a'}, and can be used as lookup table. by getting an input of 'a' it will return 'z', ... steps: - take an input - create a string variable with the letters from 'a ... z' - the dictionary can be created by using the dict() constructor, with the letter string and a reverse of the letter string, and put together by using the zip() function - now characters can be read from the input string using a for loop. each character is now used to get the reversed letter version from the dictionary. so we can create a new string. (this complete step can also be done with a list comprehension) - finally output of the new string

+4

Fortunate Oyeyemi I had a look at your profile and can't see where you have commenced a Python tutorial, so I would suggest you start with Python for Beginners, followed by Intermediate Python. You will then know how to do this

+3

I have already commenced a python tutorial so I'll just continue as u have suggested Thanks alot

+2

Fortunate Oyeyemi List Slicing will provide your answer. Just remember that lists & strings can both be sliced, and manipulated using the same syntax

+2

Rik Wittkopp Ok Thanks Boss 🙇🙇