Convert numbers into corresponding letter using Python -
I was thinking that it is possible to convert numbers into their respective alphabetical values. Then
1 - & gt; A 2 - & gt; B I was planning to create a program that lists all alphabetical combinations possibly for the length specified by the user.
I know how to build the rest in addition to this program! Any help would be wonderful
import string for x, y in zip (category (1, 27), string .ascii_lowercase): Import string for x (y, x) or or
x, y annumer (string.ascii_lowercase, 1): print ( X, y) or
for x, in y ((x + 1, chr (ord ('a') + x) (26) for x: print (x, y) All solutions above the output lowercase letters from the English alphabet with all the posts:
1 a ... 26 z You You can easily create a dictionary to access the letter (value) by their position (keys). For example:
import string d = dict (count (string.ascii_lowercase, 1) ) Print (d [3]) # c
Comments
Post a Comment