How to make a program to convert a sentence into a number? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How to make a program to convert a sentence into a number?

I want to assign like this a=12, n=14, t=17 and when in input if I write "ant" I need an output of 121417 and I want to reverse it too like as I'll write 121417 in input I want output as "ant". It is an example of word I think if a program will work with a word it'll also work for a sentence.

12th Oct 2021, 7:51 PM
Umar Ansari
Umar Ansari - avatar
3 Answers
+ 2
Hello sir, all you have to do is create a dictionary. Key value pairs is the answer you are looking for
12th Oct 2021, 11:04 PM
Jibraeel Abdelwahhab
Jibraeel Abdelwahhab - avatar
+ 1
Maybe you should figure out what language to use first. You've tagged five. https://code.sololearn.com/W3uiji9X28C1/?ref=app
12th Oct 2021, 9:11 PM
Simon Sauter
Simon Sauter - avatar
+ 1
You can examples of this code in the trending page of sololearn as well. Those code titled "Enter your name to see magic" show you how they approach the same problem.
12th Oct 2021, 11:05 PM
Jibraeel Abdelwahhab
Jibraeel Abdelwahhab - avatar