0
Function that turns numbers into letters and vice versa (this got deleted for some reason)
It is intended to implement two auxiliary functions that allow us to convert letters into numbers and vice versa. They will be helpful in some of the following questions. Define the functions “char2idx” and “idx2char” whose purpose is, respectively, to convert letters to numbers and numbers to letters. We assume that 'A' is zero, 'B' is 1, and so on, until the letter 'Z' is 25.
2 Antworten
0
Looks similar to https://code.sololearn.com/cr9z68AZhe6z/#py
0
char2idx: Use the ord() function to get the ASCII value of the letter. Subtract 65 from the ASCII value to so that A (65) will be 0, B (66) will be 1, and so on.
idx2char: Use the chr () function to convert the calculated char value into a string. Calculate the character value by reversing the above.