Skip to content

Instantly share code, notes, and snippets.

@nick3499
Last active April 30, 2020 12:31
Show Gist options
  • Save nick3499/157f5efeb0321c5609805f5b33eb6098 to your computer and use it in GitHub Desktop.
Save nick3499/157f5efeb0321c5609805f5b33eb6098 to your computer and use it in GitHub Desktop.
Python 3: Convert Letters to Pythagorean Numerology: dict(), input(), list(), upper(), replace(), print()
#! /bin/python3
'''`pythag_convert` module contains `pythag_convert()` method which converts \
text string to Pythagorean number system.'''
from sys import argv
def pythag_convert():
'''pythag_convert() converts text string to Pythagorean numerology system.
$ python3 ~/scripts_path/pythag_convert.py Foo'''
pythag = {
"A": 1, "B": 2, "C": 3, "D": 4, "E": 5, "F": 6, "G": 7, "H": 8, "I": 9,
"J": 1, "K": 2, "L": 3, "M": 4, "N": 5, "O": 6, "P": 7, "Q": 8, "R": 9,
"S": 1, "T": 2, "U": 3, "V": 4, "W": 5, "X": 6, "Y": 7, "Z": 8}
# letter_list = list(input("Enter text string: ").upper().replace(" ", ""))
letter_list = list(argv[1].upper()) # use no spaces; converts to uppercase
for l in letter_list:
print(f'\x1b[1;36m{l}\x1b[0m: {pythag[l]}')
if __name__ == '__main__':
pythag_convert()
@nick3499
Copy link
Author

nick3499 commented Jan 5, 2020

Made available through the MIT license

Documentation: https://colab.research.google.com/drive/1CMJJjgzPHEgy9XgmY2OGtiHc2SbJiCIo

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