Create a function that takes in the sum and age difference of two people, calculates their individual ages, and returns a pair of values (oldest age first) if those exist or `null/None` if:

* `sum < 0`
* `difference < 0`
* Either of the calculated ages come out to be negative

Difficulty: introductory

Starter code:

def get_ages(sum_, difference):
	

Solutions:
def get_ages(a,b):
    x = (a+b)/2
    y = (a-b)/2
    return None if a<0 or b<0 or x<0 or y<0 else (x,y)

def get_ages(s, diff):
    older, younger = (s / 2) + (diff / 2), (s / 2) - (diff / 2)  
    if older >= younger >= 0:
        return (older, younger)

def get_ages(s, diff):
    older = (s / 2) + (diff / 2)
    younger = (s / 2) - (diff / 2)
    
    if older >= younger >= 0:
        return (older, younger)

def get_ages(sum_, difference):
    a = (sum_ + difference) / 2
    b = sum_ - a
    if 0 <= b <= a:
        return a, b

def get_ages(a, b):
    x,y = (a+b)/2, (a-b)/2
    if a>=0 and b>=0 and x>=0 and y>=0:
        return x,y

def get_ages(add, dif):
    return None if any(n < 0 for n in (add, dif, add - dif)) else ((add + dif) / 2, (add - dif) / 2)


def get_ages(sum_, difference):
    x=(sum_+difference)/2
    y=sum_-x
    return None if any(e<0 for e in(x,y,sum_,difference)) else (x,y)

def get_ages(sum_, difference): 
    # Calculating the Ages
    ret = ((sum_ + difference)/2,(sum_ - difference)/2)
    # verifying the assumptions
    if difference < 0 or (ret[1]<0 or ret[0]<0): return None 
    else: return ret

def get_ages(sum, difference):
    age1 = (sum+difference)/2
    age2 = sum - age1
    if sum < 0 or difference < 0 or age1 < 0 or age2 < 0:
        return None    
    if age1 > age2:
        return age1, age2 
    else:
        return age2, age1

get_ages=lambda s,d:(lambda*a:None if any(x<0for x in(*a,s,d))else a)((s+d)/2,(s-d)/2)