Consider the following equations:

SEVEN PLUS TWO = EIGHTEEN MINUS NINE = EIGHTEEN OVER TWO

That's true enough on its face. But Susan Thorpe discovered that if each letter is replaced with the number of its position in the alphabet (A=1, B=2, C=3, …), then the equivalence persists — the values in each of the three phrases total 191.

Assignment

None of these functions may make a distinction between uppercase and lowercase letters.

Example

>>> character_value('A')
1
>>> character_value('z')
26
>>> character_value('!')
0

>>> string_value('SEVEN PLUS TWO')
191
>>> string_value('eighteen minus nine')
191
>>> string_value('Eighteen Over Two')
191
>>> string_value('Tea For Two')
123

>>> istantamount('SEVEN PLUS TWO', 'eighteen minus nine')
True
>>> istantamount('eighteen minus nine', 'Eighteen Over Two')
True
>>> istantamount('SEVEN PLUS TWO', 'Tea For Two')
False

>>> isequality('SEVEN PLUS TWO = eighteen minus nine')
True
>>> isequality('eighteen minus nine=Eighteen Over Two')
True
>>> isequality('SEVEN PLUS TWO = eighteen minus nine = EIGHTEEN OVER TWO')
False
>>> isequality('SEVEN PLUS TWO ~ eighteen minus nine')
False
>>> isequality('SEVEN PLUS TWO = Tea For Two')
False

Resources