Last active
December 17, 2015 20:47
-
-
Save zeimusu/df842c108c0f2bee2890 to your computer and use it in GitHub Desktop.
Use a numeralogical technique known to teens from the '80s to predict the love percentage from names
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
#!/usr/bin/env python3 | |
#Use: LoveCalculator.py "Katy Perry" "Justin Bieber" | |
import sys | |
import itertools | |
def pairwise(iterable): | |
"s -> (s0,s1), (s1,s2), (s2, s3), ..." | |
a, b = itertools.tee(iterable) | |
next(b, None) | |
return zip(a, b) | |
def sumline(n): | |
"""Add pairs of digits in a string of digits. | |
So "22" -> "4" | |
"67" -> "13" | |
"123" -> "25" | |
"456" -> "911" | |
""" | |
result="" | |
for (a,b) in pairwise(n): | |
result += str(int(a)+int(b)) | |
return result | |
name1 = sys.argv[1] | |
name2 = sys.argv[2] | |
names = name1 + name2 | |
numberstring = ("".join([str(names.lower().count(k)) for k in 'loves'])) | |
print("LOVES") | |
while len(numberstring)>2: | |
print(numberstring) | |
numberstring = sumline(numberstring) | |
print(name1, "loves", name2, numberstring+'%') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment