You were given a string of integer temperature values. Create a function `close_to_zero(t)` and return the closest value to 0 or `0` if the string is empty. If two numbers are equally close to zero, return the positive integer.

Difficulty: introductory

Starter code:

def close_to_zero(t):
	

Solutions:
def close_to_zero(t):
    if len(t)==0:
        return (0)
    x=t.split(" ")
    l=[]
    poz=[]
    neg=[]
    for i in x:
        l.append(int(i))
    for i in l:
        if i == 0:
            return (0)
        if i>0:
            poz.append(i)
        if i<0:
            neg.append(i)
        
    if 0-min(poz)==max(neg):
        return min(poz)
    if 0-min(poz)>max(neg):
        return min(poz)
    else: return max(neg)


def close_to_zero(t):
    n = min([int(s) for s in t.split()] or [0], key = abs)
    return abs(n) if str(-n) in t.split() else n

def close_to_zero(t):
    return min((int(n) for n in t.split()), key=lambda n: (abs(n), n < 0), default=0)

def close_to_zero(t):
    return sorted(map(int, t.split()), key=lambda i: (abs(i), -i))[0] if t else 0



def close_to_zero(t):
    T=[int(v) for v in t.split()]
    return T and sorted(sorted(T,reverse=True),key=abs)[0] or 0

def close_to_zero(t):
    t = [int(x) for x in t.split()]
    return min(t or [0],key=lambda t:(abs(t),-t))

close_to_zero=lambda t:min(map(int,t.split()),key=lambda n:(abs(n),-n),default=0)

def close_to_zero(t):
    return 0 if not t else int(min(sorted(t.split(), reverse=True), key=lambda x: abs(int(x))))