Skip to content

Instantly share code, notes, and snippets.

@zarino
Created April 16, 2013 20:04
Show Gist options
  • Save zarino/5399144 to your computer and use it in GitHub Desktop.
Save zarino/5399144 to your computer and use it in GitHub Desktop.
Another love forecasting app from #PyPool
#!/usr/bin/env python
# By David, Jonathan, David, and Zarino
import sys
names = sys.argv
score = 0.0
p1 = names[1].lower()
p2 = names[2].lower()
# People with "x" in their name are awesome
if "x" in p1 or "x" in p2:
score += 1
# Same length means compatibility
if len(p1) == len(p2):
score += 1
# Number of common chars
for c in p1:
if c in p2:
score += 2
# Vowels are cool
vowels = 'aeiou'
for c in vowels:
if c in p1 and c in p2:
score += 1
# No, really, we like vowels
def vowelscheck(p):
vowelsmissing = 0
for c in vowels:
if c not in p:
vowelsmissing += 0.2
return vowelsmissing
score -= vowelscheck(p1)
score -= vowelscheck(p2)
# The perfect score
maximum = len(p1) + len(p2)
# Your score, loser
percent = score / maximum * 100
print "%s's compatibility with %s is %.1f%%!" % (names[1],names[2],percent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment