+ 2
Conversion Program of strings to numbers
I need help with writing a program that convert a string of letters to numbers. I,m thinking of a criteria where a letter is given a numerical number according to its position in the alphabet i.e A = 1, B = 2, …. etc But where, special characters remain unchanged Example: Input: Bed-1#2%3 Output: 254-1#2%3
10 Respostas
+ 7
Izaiah Kay ,
please link your code here so that we can see where the issue is.
+ 4
Hint:
Depending of what you like more you could
- define a list or better a dictionary with all characters and its corresponding numbers / special characters;
- receive input string;
- define results string;
- and take from your list / dictionary the right item and add to the result;
- print the result.
For more try to code it and show your attempt here.
+ 3
+ 3
Izaiah Kay ,
You never defined the input_list what you try to use in below statement. I think you wanted have here the input string, you declared before.
output_list = [ str(get_index(x)) for x in list(input)]
+ 2
Thanks JaScript . Got it
+ 2
Happy coding Izaiah Kay !
+ 2
JaScript I am just messing around with the code, its not a real encryption.Its just a foundation for an encryption i intend to code in future. I just named it that 😄
+ 1
Whether and when this encription really works that can be seen, when do you can have a result from a decriptor, which is the same as the input string. Did you check it Izaiah Kay ?