Skip to content

Instantly share code, notes, and snippets.

@AndrewKiri
Last active August 13, 2018 19:31
Show Gist options
  • Save AndrewKiri/0d07a34830b1a9aab8650544de0a4623 to your computer and use it in GitHub Desktop.
Save AndrewKiri/0d07a34830b1a9aab8650544de0a4623 to your computer and use it in GitHub Desktop.
test py py py (first task)
def donate(monthly_profits):
def lowest(a, b, c):
if a > b > c:
return "C"
elif b > a > c:
return "C"
elif c > b > a:
return "A"
elif c > a > b:
return "B"
elif b > c > a:
return "A"
elif a == b == c:
return "A"
elif a == b & a != c:
return "A"
elif b == c & b != a:
return "B"
elif c == a & a != b:
return "A"
charities = {
"A": 0,
"B": 0,
"C": 0
}
result = []
for month in monthly_profits:
letter = lowest(int(charities["A"]), int(charities["B"]), int(charities["C"]))
charities[letter] = charities[letter] + month
result.append(letter)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment