Skip to content

Instantly share code, notes, and snippets.

@neale
Last active August 29, 2015 14:20
Show Gist options
  • Save neale/71556af144eca168c5c1 to your computer and use it in GitHub Desktop.
Save neale/71556af144eca168c5c1 to your computer and use it in GitHub Desktop.
Finds common factor between two unorganized lists
#!/usr/bin/env python
def answer(x, y):
sum_x, sum_y = sum(x), sum(y)
before = max(x, y)
after = min(x, y)
if after == 0:
return 100
return int(round(abs((sum(before) / sum(after) - 1)) * 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment