Created
August 28, 2022 18:42
-
-
Save waterrmalann/e8b4287fe241a3cc80399083fc0d136b to your computer and use it in GitHub Desktop.
Calculate the position of two names in FLAME
This file contains 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
def get_flame(name1, name2): | |
"""Calculate the FLAME position of two names.""" | |
FLAME = ("Friendship", "Love", "Affection", "Marriage", "Enemies") # "Siblings" as an additional entry. | |
# Get rid of the spaces and turn everything into lowercase. | |
name1_crossed = name1.replace(' ', '').lower() | |
name2_crossed = name2.replace(' ', '').lower() | |
# Cross out common letters from both names. | |
for letter in name1.lower(): | |
name2_crossed = name2_crossed.replace(letter, '') | |
for letter in name2.lower(): | |
name1_crossed = name1_crossed.replace(letter, '') | |
# Count the remaining letters and add them together. | |
total = len(name1_crossed) + len(name2_crossed) | |
result = (total % len(FLAME)) - 1 | |
return FLAME[result] | |
def main(): | |
while True: | |
n1 = input("Name 1: ").strip() | |
n2 = input("Name 2: ").strip() | |
flame = get_flame(n1, n2) | |
print(n1, '+', n2, '=', flame) | |
print() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment