Jan-30-2021, 02:24 AM
In the first place, why are you building a dictionary that maps from position to letter, but then using it to look from letter to position? My first thought is that you should build the dictionary in that direction and use it naturally. What this program does is use the dictionary like a list. It would be simpler to just loop through the original
Next, while
Finally, the function has no return call. So if you are calling it, you will always get back
string.ascii_lowercase
than loop through the dictionary.Next, while
alphabet_position
loops over the characters in the input, it overwrites strin
each time through the loop. So only the final character is kept in that variable.Finally, the function has no return call. So if you are calling it, you will always get back
None