Skip to content

Instantly share code, notes, and snippets.

@nick3499
Created October 24, 2020 11:09
Show Gist options
  • Save nick3499/be3b8f8ba499cb03fc7e2da9dc07a82d to your computer and use it in GitHub Desktop.
Save nick3499/be3b8f8ba499cb03fc7e2da9dc07a82d to your computer and use it in GitHub Desktop.
Simple Gematria Converter: dict, input(), list(), for loop,
#! /usr/bin/env python
'''`simple_gematria_converter` module contains `convert()` method which \
converts letters to simple gematria values.'''
def convert():
'''Convert alphabetical characters to numerological integers.'''
char_num = {
'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7,
'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14,
'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21,
'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26, ' ': ' '
}
text_input = input('Enter alphabetical string: ').lower()
char_list = list(text_input)
num_total = 0
for char in char_list:
num_total += char_num[char]
print(f"\x1b[1;94m{char}\x1b[0m : {str(char_num[char]).rjust(2, ' ')}")
print(f'Total: {num_total}')
if __name__ == '__main__':
convert()
@nick3499
Copy link
Author

This script expressly made available under MIT license which is a permissive free software license.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment