You can download this code by clicking the button below.
This code is now available for download.
Calculate the difference in positions of two letters in the English alphabet.
Technology Stack : Built-in libraries
Code Type : Function
Code Difficulty : Beginner
def a_to_z_index(a, b):
def index_of(char):
return ord(char) - ord('a')
return index_of(a) - index_of(b)