-
Notifications
You must be signed in to change notification settings - Fork 1
Functions (1) find_index(letter)
Sam Ruben Abraham edited this page Aug 23, 2020
·
1 revision
So , what this function basically does has been mentioned in the Home Page and hence I think that you've understood what it does.
Let's have a quick glance at its code :
alphabets = ['A','B','C','D','E','F','G','H',
'I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','X','Y','Z'] # series of alphabets in order
def find_index(letter):
'''Returns the index of the alphabet in the series of alphabet'''
return alphabets.index(letter.upper())
So, here's that array called alphabets
that I had mentioned before. This is the reference array used by the whole API.
Look at the function now : it returns the index of the letter, which means that one part of the calculation required for the formula mentioned in the prologue is done.
Thus, when you import this module to your workspace and call the find_index
function , you get the index, from which you can calculate the required position value by simply adding 1 to what you get.