Last active
April 30, 2020 12:31
-
-
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()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made available through the MIT license
Documentation: https://colab.research.google.com/drive/1CMJJjgzPHEgy9XgmY2OGtiHc2SbJiCIo