It is 2050 and romance has long gone, relationships exist solely for practicality.

MatchMyHusband is a website that matches busy working women with perfect house husbands. You have been employed by MatchMyHusband to write a function that determines who matches!!

The rules are... a match occurs providing the husband's "usefulness" rating is greater than or equal to the woman's "needs".

The husband's "usefulness" is the SUM of his cooking, cleaning and childcare abilities and takes the form of an array .

usefulness example --> [15, 26, 19]    (15 + 26 + 19) = 60

Every woman that signs up, begins with a "needs" rating of 100. However, it's realised that the longer women wait for their husbands, the more dissatisfied they become with our service. They also become less picky, therefore their needs are subject to exponential decay of 15% per month. https://en.wikipedia.org/wiki/Exponential_decay

Given the number of months since sign up, write a function that returns "Match!" if the husband is useful enough, or "No match!" if he's not.

Difficulty: introductory

Starter code:

def match(usefulness, months):
	

Solutions:
def match(usefulness, months):
    return "Match!" if sum(usefulness) >= 0.85**months * 100 else "No match!"

def match(usefulness, months):
    return 'Match!' if sum(usefulness) >= 100*0.85**months else 'No match!'

def current(usefulness):
    return sum(usefulness)

def needed(months):
    if months == 0:
        return 100
    else:
        return 0.85 * needed(months - 1)

def match(usefulness, months):
    if current(usefulness) < needed(months):
        return "No match!"
    else:
        return "Match!"

def match(usefulness, months):
    return f"{'M' if sum(usefulness) >= 100 * 0.85**months else 'No m'}atch!"

def match(a, n):
    return "Match!" if sum(a) >= 100 * 0.85**n else "No match!"

def match(usefulness, months):
    match = sum(usefulness) >= 100 * 0.85 ** months
    return 'Match!' if match else 'No match!'

match=lambda u, m: ["No match!","Match!"][sum(u)>=100*0.85**m]

def match(usefulness, months):
    return ["Match!", "No match!"][sum(usefulness) < 100 * 0.85 ** months]

def match(usefulness, months):
    decay, needs = 0.15, 100
    return "Match!" if needs * (1 - decay)**months <= sum(usefulness) else "No match!"

def match(a,m):
    return ['No match!','Match!'][sum(a) >= 100*(0.85)**m]