How could I print out the nth letter of the alphabet in Python?
chr
and ord
convert characters from and to integers, respectively. So:
chr(ord('a') + 5)
is the letter 'f'
.
chr(ord('a')+5)
ASCII math aside, you don't have to type your letters table by hand.
The string constants in the string module
provide what you were looking for.
>>> import string
>>> string.ascii_uppercase[5]
'F'
>>>