def swap_unique_keys_values(d):
    tempd = {}
    for k, v in list(d.items()):
        if d.count(v) < 2:
            tempd = {k: v}
    new_dict = {v: k for k, v in list(tempd.items())}
    return new_dict


def swap_unique_keys_values(d):
    tempd = {}
    for k, v in list(d.items()):
        if v.count(v) < 2:
            tempd = {k: v}
    new_dict = {v: k for k, v in list(tempd.items())}
    return new_dict

Swap the keys of a dictionary with its unique values.


def swap_unique_keys_values(d):
    tempd = {}
    for k, v in list(d.items()):
        if v.count(str(v)) < 2:
            tempd = {k: v}
    new_dict = {v: k for k, v in list(tempd.items())}
    return new_dict


def swap_unique_keys_values(d):
    tempd = {}
    tempd = {k: v for k, v in list(d.items()) if v.count(v) < 2}
    new_dict = {v: k for k, v in list(tempd.items())}
    return new_dict


def swap_unique_keys_values(d):
    tempd = {}
    tempd = {k: v for k, v in list(d.items()) if str(v).count(v) < 2}
    new_dict = {v: k for k, v in list(tempd.items())}
    return new_dict


def swap_unique_keys_values(d):
    tempd = {}
    tempd = {k: v for k, v in list(d.items()) if list(v).count(v) < 2}
    new_dict = {v: k for k, v in list(tempd.items())}
    return new_dict


def swap_keys_values(d):
    new_dict = dict([(v, k) for k, v in list(d.items())])
    return new_dict

Swap the keys of a dictionary with its values.


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d[k]
        if v not in new_dict:
            new_dict[v] = k
        else:
            del new_dict[v]
    return new_dict


def swap_unique_keys_values(d):
    keys = []
    values = []
    dict_keys = []
    dict_values = []
    dump = []
    for k, v in list(d.items()):
        keys.append(k)
        values.append(v)
    for num in values:
        test = num
        values = values[1:]
        if test in values:
            dump.append(test)
        elif test not in values and test not in dump:
            dict_keys.append(test)
            dict_values.append(keys[0])
        keys = keys[1:]
    d = {}
    for i in range(0, len(dict_keys)):
        d[dict_keys[i]] = dict_values[i]
    return d


def swap_unique_keys_values(d):
    return {v: k for k, v in list(d.items()) if list(d.values()).count(v) == 1}


def swap_keys_values(d):
    n_d = {}
    for k in d:
        n_d[d[k]] = k
    return n_d


def swap_keys_values(d):
    return {v: k for k, v in list(d.items())}


def swap_keys_values(my_dict):
    new_dict = dict((v, k) for k, v in list(d.items()))
    return new_dict


def swap_keys_values(my_dict):
    new_dict = dict((v, k) for k, v in list(my_dict.items()))
    return new_dict


def swap_keys_values(d):
    d = {v: k for k, v in list(d.items())}
    return d


def swap_keys_values(d):
    new = {}
    for z, q in list(d.items()):
        new[q] = z
    return list(new.items())


def swap_unique_keys_values(my_dict):
    d = {}
    for key in my_dict:
        value = my_dict.get(k)
        if value in d:
            del d[v]
        else:
            d[v] = k
    return d


def swap_unique_keys_values(d):
    return set({v: k for k, v in list(d.items())})


def swap_unique_keys_values(my_dict):
    d = {}
    for key in my_dict:
        value = my_dict.get(key)
        if value in d:
            del d[value]
        else:
            d[value] = key
    return d


def swap_keys_values(d):
    new_dict = {}
    for z, q in list(d.items()):
        new[q] = z
    return list(new_dict.items())


def swap_keys_values(d):
    new_dict = {}
    for z, q in list(d.items()):
        new_dict[q] = z
    return list(new_dict.items())


def swap_keys_values(d):
    new_dict = {}
    for z, q in list(d.items()):
        new_dict[q] = z
    return new_dict


def swap_unique_keys_values(d):
    return set({v: k for k, v in d})


def swap_unique_keys_values(d):
    return {v: k for k, v in set(d.items())}


def swap_unique_keys_values(d):
    return {v: k for k, v in set(d.items()) if v not in list(d.keys())}


def swap_unique_keys_values(d):
    return {v: k for k, v in list(d.items()) if v not in list(d.keys())}


def swap_keys_values(d):
    return {v: k for k, in v in list(d.items())}


def swap_unique_keys_values(d):
    return {v: k for k, v in set(d.items()) if v not in set.intersection(
        list(d.items()))}


def swap_unique_keys_values(d):
    return {v: k for k, v in set.intersection(list(d.items()))}


def swap_unique_keys_values(d):
    return {v: k for k, v in list(d.items()) if v in list(d.keys())}


def swap_unique_keys_values(d):
    return {v: k for k, v in list(d.items()) if (k, v) not in set.
        intersection(list(d.items()))}


def swap_unique_keys_values(d):
    return {v: k for k, v in list(d.items()) if list(d.values()).count(v) == 1}


def swap_unique_keys_values(d):
    return {v: k for k, v in list(d.items()) if list(list(d.values()).count
        (v) == 1)}


def swap_keys_values(d):
    return {v: k for k, v in list(d.items())}


def swap_keys_values(d):
    new_dict = dict((v, k) for k, v in list(d.items()))
    return new_dict


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d.get(k)
        if v in new_dict:
            del new_dict[v]
        else:
            new_dict[v] = k
    return new_dict


def swap_unique_keys_values(d):
    new_dict = {}
    seen = []
    for z, q in list(d.items()):
        if q not in seen:
            new_dict[q] = z
        seen.append(q)
    return new_dict


def swap_unique_keys_values(d):
    new_d = {}
    for k, v in list(d.items()):
        if not v in new_d:
            new_d[v] = k
        else:
            del new_d[v]
    return new_d


def swap_keys_values(x):
    new = {v: k for k, v in list(x.items())}
    return new


def swap_unique_keys_values(x):
    new = {}
    for k in x:
        c = x.get(k)
        if c in new:
            del new[v]
        else:
            new[v] = k
    return new


def swap_unique_keys_values(x):
    new = {}
    for k in x:
        c = x.get(k)
        if c in new:
            del new[c]
        else:
            new[c] = k
    return new


def swap_keys_values(d):
    new_d = {v: k for k, v in list(d.items())}
    return new_d


def swap_unique_keys_values(d):
    seen = {}
    result = {}
    for k, v in d.items():
        if v in seen:
            del seen[v]
        else:
            seen[v] = k
            result[v] = k
    return seen


def swap_unique_keys_values(d):
    seen = {}
    result = {}
    for k, v in list(d.items()):
        if v in seen:
            del seen[v]
        else:
            seen[v] = k
            result[v] = k
    return seen


def swap_unique_keys_values(d):
    A = False
    keys = []
    values = []
    uniqueness = []
    swapped_unique_d = {}
    for key in d:
        keys.append(key)
        values.append(d[key])
    for item in keys:
        uniqueness.append(True)
    i = 0
    while i < len(keys):
        p = i + 1
        while p < len(values):
            if values[i] == values[p]:
                uniqueness[i] = A
                uniqueness[p] = A
            p += 1
        i += 1
    j = 0
    while j < len(uniqueness):
        if uniqueness[j]:
            swapped_unique_d[values[j]] = keys[j]
        j += 1
    return swapped_unique_d


def swap_keys_values(d):
    new_dict = {}
    for keys in list(d.keys()):
        temp = d[keys]
        new_dict[temp] = keys
    return new_dict


def swap_unique_keys_values(d):
    new_dict = {}
    for keys in list(d.keys()):
        temp = d[keys]
        if temp in new_dict:
            del new_dict[temp]
        else:
            new_dict[temp] = keys
    return new_dict


def swap_keys_values(d):
    swapped_d = {}
    for key in d:
        swapped_d[d[key]] = key
    return swapped_d


def swap_unique_keys_values(d):
    new_d = {}
    for k in d:
        v = d.get(k)
        if v in new_dict:
            del new_dict[v]
        else:
            new_dict[v] = k
    return new_dict


def swap_unique_keys_values(d):
    new_d = {}
    for k in d:
        v = d.get(k)
        if v in new_d:
            del new_d[v]
        else:
            new_d[v] = k
    return new_d


def swap_unique_keys_values(d):
    A = False
    keys = []
    values = []
    unique = []
    swapped_unique_d = {}
    for key in d:
        keys.append(key)
        values.append(d[key])
    for item in keys:
        unique.append(True)
    i = 0
    while i < len(keys):
        p = i + 1
        while p < len(values):
            if values[i] == values[p]:
                unique[i] = A
                unique[p] = A
            p += 1
        i += 1
    j = 0
    while j < len(uniqueness):
        if uniqueness[j]:
            swapped_unique_d[values[j]] = keys[j]
        j += 1
    return swapped_unique_d


def swap_unique_keys_values(d):
    A = False
    keys = []
    values = []
    unique = []
    swapped_unique_d = {}
    for key in d:
        keys.append(key)
        values.append(d[key])
    for item in keys:
        unique.append(True)
    i = 0
    while i < len(keys):
        p = i + 1
        while p < len(values):
            if values[i] == values[p]:
                unique[i] = A
                unique[p] = A
            p += 1
        i += 1
    j = 0
    while j < len(unique):
        if uniqueness[j]:
            swapped_unique_d[values[j]] = keys[j]
        j += 1
    return swapped_unique_d


def swap_unique_keys_values(d):
    A = False
    keys = []
    values = []
    unique = []
    swapped_unique_d = {}
    for key in d:
        keys.append(key)
        values.append(d[key])
    for item in keys:
        unique.append(True)
    i = 0
    while i < len(keys):
        p = i + 1
        while p < len(values):
            if values[i] == values[p]:
                unique[i] = A
                unique[p] = A
            p += 1
        i += 1
    j = 0
    while j < len(unique):
        if unique[j]:
            swapped_unique_d[values[j]] = keys[j]
        j += 1
    return swapped_unique_d


def swap_keys_values(d):
    for i in d:
        j[d[i]] = i
        return j


def swap_keys_values(d):
    for i in d:
        j[d[i]] = i
    return j


def swap_unique_keys_values(d):
    new_d = {}
    doubles = set()
    for k, v in list(d.items()):
        if v in new_d:
            doubles.add(v)
        new_d[v] = k
    for k in doubles:
        del new_d[k]
    return new_d


def swap_keys_values():
    {v: k for k, v in list(d.items())}


def swap_keys_values(d):
    {v: k for k, v in list(d.items())}


def swap_keys_values(d):
    {v: k for k, v in d}


def swap_keys_values(d):
    return {v: k for k, v in list(d.items())}


def swap_unique_keys_values(d):
    for i in d:
        if d[i] in j:
            del j[d[i]]
        else:
            j[d[i]] = i
    return j


def swap_unique_keys_values(d):
    n_dict = {}
    double = set()
    for k, v in list(d.items()):
        if v in n_dict:
            double.add(v)
        n_dict[v] = k
    for k in double:
        del n_dict[k]
    return n_dict


def swap_keys_values(d):
    new_dictionary = {}
    for x in d:
        key = x
        value = d[x]
        new_dictionary[value] = key
    return new_dictionary


def swap_unique_keys_values(d):
    new_dictionary = {}
    for x in d:
        key = x
        value = d[x]
        new_dictionary[value] = key
    new_dictionary.pop(7)
    return new_dictionary


def swap_unique_keys_values(d):
    return {v: k for k, v in list(d.items()) if list(d.values()).count(v) == 1}


def swap_unique_keys_values(d):
    d = {v: k for k, v in list(d.items())}
    return d


def swap_keys_values(d):
    swapped_dict = dict(list(zip(list(d.values()), list(d.keys()))))
    return swapped_dict


def swap_unique_keys_values(d):
    swapped_dict = dict(list(zip(list(d.values()), list(d.keys()))))
    return set(swapped_dict)


def swap_unique_keys_values(d):
    swapped_dict = set(dict(list(zip(list(d.values()), list(d.keys())))))
    return swapped_dict


def swap_unique_keys_values(d):
    swapped_dict = {v: k for k, v in list(d.items())}
    return swapped_dict


def swap_unique_keys_values(d):
    swapped_dict = {v: k for k, v in list(d.items())}
    return set(swapped_dict)


def swap_keys_values(d):
    reversed_d = {(v, k) for k, v in d.items()}
    return reversed_d


def swap_keys_values(d):
    reversed_d = dict((v, k) for k, v in d.items())
    return reversed_d


def swap_unique_keys_values(d):
    seen = list(d.keys())
    swapped_dict = dict(list(zip(list(d.values()), list(d.keys()))))
    for v, k in swapped_dict:
        if k in seen:
            break
    return swapped_dict


def swap_unique_keys_values(d):
    return {v: k for k, v in list(d.items()) if v in list(d.values())}


def swap_unique_keys_values(d):
    seen = list(d.keys())
    swapped_dict = dict(list(zip(list(d.values()), list(d.keys()))))
    print(list(swapped_dict.values()))
    return swapped_dict


def swap_unique_keys_values(d):
    values = list(d.values())
    unique = [x for x in values if values.count(x) == 1]
    swapped_dict = 0
    if unique in values:
        swapped_dict = dict(list(zip(list(d.values()), list(d.keys()))))
    return swapped_dict


def swap_unique_keys_values(d):
    values = list(d.values())
    unique = [x for x in values if values.count(x) == 1]
    swapped_dict = 0
    if unique in values:
        swapped_dict = {v: k for k, v in list(d.items())}
    return swapped_dict


def swap_unique_keys_values(d):
    values = list(d.values())
    unique = [x for x in values if values.count(x) == 1]
    swapped_dict = 0
    if unique == True:
        swapped_dict = {v: k for k, v in list(d.items())}
    return swapped_dict


def swap_keys_values():
    {v: k for k, v in list(sys.argv[1].items())}


def swap_keys_values():
    {v: k for k, v in list(sys.argv[0].items())}


def swap_unique_keys_values(d):
    c = {}
    e = []
    r = {}
    seen = {}
    for value in list(d.values()):
        if value not in c:
            c[value] = 1
        else:
            c[value] = c[value] + 1
    for keys, values in list(c.items()):
        if values == 2:
            e.append(keys)
            del values
    for key in e:
        for value in list(d.items()):
            if key not in value:
                r[value[0]] = value[1]
    my_dict = r
    new_dict = {v: k for k, v in list(my_dict.items())}
    return new_dict


def swap_unique_keys_values(d):
    c = {}
    e = {}
    r = {}
    seen = {}
    for value in list(d.values()):
        if value not in c:
            c[value] = 1
        else:
            c[value] += 1
    for keys, values in list(c.items()):
        if values == 2:
            e.append(keys)
            del values
    for key in e:
        for value in list(d.items()):
            if key not in value:
                r[value[0]] = value[1]
    my_dict = r
    new_dict = {v: k for k, v in list(my_dict.items())}
    return new_dict


def swap_keys_values(d):
    list(zip(list(d.values()), list(d.keys())))


def swap_keys_values(d):
    return dict(list(zip(list(d.values()), list(d.keys()))))


def swap_keys_values(d):
    l = Counter(list(d.values()))
    return {value: key for key, value in list(d.items()) if l[value] == 1}


def swap_unique_keys_values(d):
    l = Counter(list(d.values()))
    return {value: key for key, value in list(d.items()) if l[value] == 1}


def swap_keys_values(d):
    return {v: k for k, v in list(d.items())}


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d.get(k)
        if v in new_dict:
            del new_dict[v]
        else:
            new_dict[v] = k
    return new_dict


def swap_keys_values(a):
    for k, v in a.items:
        tmp = k
        k = v
        v = tmp
    return sorted(a)


def swap_keys_values(in_dict):
    out_dict = {}
    for t, v in list(in_dict.items()):
        out_dict[v] = t
    return out_dict


def swap_keys_values(a):
    for k, v in list(a.items()):
        tmp = k
        k = v
        v = tmp
    return sorted(a)


def swap_keys_values(a):
    for k, v in list(a.items()):
        tmp = k
        k = v
        v = tmp
    print(a)
    return sorted(a)


def swap_unique_keys_values(d):
    new = {}
    for k in d:
        v = d.get(k)
        if v in new:
            del ne[v]
        else:
            new[v] = k
    return new


def swap_unique_keys_values(d):
    new = {}
    for k in d:
        v = d.get(k)
        if v in new:
            del new[v]
        else:
            new[v] = k
    return new


def swap_keys_values(a):
    for i in a:
        tmp = i
        i = a[i]
        a[i] = tmp
    return sorted(a)


def swap_keys_values(a):
    dir = {}
    for i in a:
        dir[a[i]] = i
    return sorted(dir)


def swap_keys_values(a):
    dir = {}
    for i in a:
        dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.items()):
        if a.count(no) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if dir[a[i]] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.items()):
        if no.count(a) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if dir[a[i]] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.items()):
        if no.count(a) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        k = dir[a[i]]
        if k not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.items()):
        if no.count(a) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.items()):
        if no.count(a) > 1:
            lis.append(no)
    print(lis)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.items()):
        print(no.count(a))
        if no.count(a) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        print(no.count(a))
        if no.count(a) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        if a.count(no) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        if int(no).count(a) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        if str(no).count(a) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        print(str(no).count(a))
        if str(no).count(a) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        print(str(no).count(list(a.values())))
        if str(no).count(list(a.values())) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        print(no.count(list(a.values())))
        if no.count(list(a.values())) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        if no.count(list(a.values())) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        if list(a.values()).count(no) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        print(list(a.values()).count(no))
        if list(a.values()).count(no) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        print(values)
        print(list(a.values()).count(no))
        if list(a.values()).count(no) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        print(a.values)
        if list(a.values()).count(no) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_keys_values(d):
    d1 = {v: k for k, v in list(d.items())}
    print(d1)


def swap_unique_keys_values(a):
    lis = []
    for no in list(a.values()):
        print(list(a.values()))
        if list(a.values()).count(no) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    val = list(a.values())
    for no in val:
        if val.count(no) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    val = list(a.values())
    for no in val:
        print(val)
        if val.count(no) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    val = list(a.values())
    for no in val:
        print(lis(val))
        if val.count(no) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_keys_values(d):
    d1 = {v: k for k, v in list(d.items())}
    print(list(d1.items()))


def swap_keys_values(d):
    new_dict = {}
    for k in d:
        new_dict[d[k]] = k
    return new_dict


def swap_unique_keys_values(a):
    lis = []
    val = list(a.values())
    for no in val:
        print(val[0])
        if val.count(no) > 1:
            lis.append(no)
    dir = {}
    for i in a:
        if a[i] not in lis:
            dir[a[i]] = i
    return dir


def swap_keys_values(d):
    d1 = {v: k for k, v in list(d.items()).sorted()}
    print(list(d1.items()))


def swap_keys_values(d):
    d1 = {v: k for k, v in list(d.sorted().items())}
    print(list(d1.items()))


def swap_keys_values(d):
    d1 = {v: k for k, v in list(d.items())}
    print(list(d1.items()).sorted())


def swap_keys_values(d):
    d1 = {v: k for k, v in list(d.items())}
    for c in d1:
        print(c)


def swap_keys_values(d):
    d1 = {v: k for k, v in list(d.items())}
    return d1


def swap_keys_values(d):
    new_dict = dict((v, k) for k, v in list(d.items()))
    return new_dict


def swap_unique_keys_values(d):
    new_dict = {}
    a = []
    for v in list(d.values()):
        a.append(v)
    for k in d:
        if a.count(d[k]) == 1:
            new_dict[d[k]] = k
    return new_dict


def swap_unique_keys_values():
    d1 = {v: k for k, v in list(d.items()) if d.count(v) == 1}
    return d1


def swap_unique_keys_values():
    d1 = {v: k for k, v in list(d.items()) if d.count(d[v]) == 1}


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d.get(k)
        if v in new_dict:
            del new_dict[v]
        else:
            new_dict[v] = k
    return new_dict


def swap_unique_keys_values():
    d1 = {v: k for k, v in list(d.items()) if len(v) == 1}


def swap_unique_keys_values():
    d1 = {v: k for k, v in list(d.items()) if len(v) == 1}
    return d1


def swap_unique_keys_values(d):
    d1 = {v: k for k, v in list(d.items()) if d.count(d[v]) == 1}
    return d1


def swap_unique_keys_values(d):
    d1 = {v: k for k, v in list(d.items()) if len(v) > 1}
    return d1


def swap_unique_keys_values(d):
    d1 = {v: k for k, v in list(d.items()) if len(d[v]) > 1}
    return d1


def swap_unique_keys_values(d):
    d1 = {v: k for k, v in list(d.items()) if list(d.items()).count(v) == 1}
    return d1


def swap_unique_keys_values(d):
    d1 = {v: k for k, v in list(d.items()) if d.count(v) == 1}
    return d1


def swap_unique_keys_values(d):
    d1 = {v: k for k, v in list(d.items())}
    print(d1)
    return d1


def swap_unique_keys_values(a):
    lis = []
    for no in a:
        lis.append(no)
    dir = {}
    for i in a:
        if no.count(lis) > 1:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in a:
        lis.append(no)
    dir = {}
    for i in a:
        if lis.count(no) > 1:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in a:
        lis.append(no)
    dir = {}
    for i in a:
        if lis.count(no) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in a:
        lis.append(no)
    dir = {}
    print(lis)
    for i in a:
        if lis.count(no) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in a:
        lis.append(a[no])
    dir = {}
    for i in a:
        if lis.count(no) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in a:
        lis.append(a[no])
    dir = {}
    print(lis)
    for i in a:
        if lis.count(no) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in a:
        lis.append(a[no])
    dir = {}
    print(lis)
    for i in a:
        if no.count(lis) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in a:
        lis.append(a[no])
    dir = {}
    for i in a:
        if a[no].count(lis) < 2:
            dir[a[i]] = i
    return dir


def swap_keys_values(d):
    d2 = dict((v, k) for k, v in list(d.items()))
    return d2


def swap_unique_keys_values(a):
    lis = []
    for no in a:
        lis.append(str(a[no]))
    dir = {}
    for i in a:
        if str(a[no]).count(lis) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = []
    for no in a:
        lis.append(str(a[no]))
    dir = {}
    for i in a:
        if lis.count(str(a[no])) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(d):
    d1 = {v: k for k, v in list(d.items())}
    for c in d1:
        print(c)


def swap_unique_keys_values(d):
    d1 = list(d.items())
    print(d1)


def swap_unique_keys_values(d):
    dict = {}
    for k in d:
        v = d.get(k)
        if v in dict:
            del dict[v]
        else:
            dict[v] = k
    return dict


def swap_unique_keys_values(d):
    d = list(d.items())
    for c in d:
        print(c)


def swap_unique_keys_values(a):
    lis = ''
    for no in a:
        lis += a[no]
    dir = {}
    for i in a:
        if lis.count(str(a[no])) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = ''
    for no in a:
        lis += a[no]
    dir = {}
    for i in a:
        if str(a[no]).count(lis) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = ''
    for no in a:
        lis += str(a[no])
    dir = {}
    for i in a:
        if str(a[no]).count(lis) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = ''
    for no in a:
        lis += str(a[no])
    dir = {}
    print(lis)
    for i in a:
        if str(a[no]).count(lis) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(a):
    lis = ''
    for no in a:
        lis += str(a[no])
    dir = {}
    print(lis)
    for i in a:
        print(str(a[no]).count(lis))
        if str(a[no]).count(lis) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(d):
    d = list(d.items())
    l = [(v, k) for k, v in d if d.count(c[1]) == 1]
    print(l)


def swap_unique_keys_values(a):
    lis = ''
    for no in a:
        lis += str(a[no])
    dir = {}
    print(lis)
    for i in a:
        print(lis.count(str(a[no])))
        if str(a[no]).count(lis) < 2:
            dir[a[i]] = i
    return dir


def swap_unique_keys_values(d):
    d = list(d.items())
    l = [v for k, v in d]
    print(l)


def swap_unique_keys_values(d):
    c = {}
    e = []
    r = {}
    seen = {}
    for value in list(d.values()):
        if value not in c:
            c[value] = 1
        else:
            c[value] += 1
    for keys, values in list(c.items()):
        if values == 2:
            e.append(keys)
            del values
    for key in e:
        for value in list(d.items()):
            if key not in value:
                r[value[0]] = value[1]
    my_dict = r
    new_dict = {v: k for k, v in list(my_dict.items())}
    return new_dict


def swap_unique_keys_values(d):
    d = list(d.items())
    l = [v for k, v in d]
    z = []
    for c in l:
        if l.count(c) == 1:
            z.append(c)
    d1 = {v: k for k, v in list(d.items()) if v in z}
    return d1


def swap_unique_keys_values(d):
    l = [v for k, v in d]
    z = []
    for c in l:
        if l.count(c) == 1:
            z.append(c)
    d1 = {v: k for k, v in list(d.items()) if v in z}
    return d1


def swap_unique_keys_values(d):
    l = [(k, v) for k, v in d]
    z = []
    for c in l:
        if l.count(c[1]) == 1:
            z.append(c[1])
    d1 = {v: k for k, v in list(d.items()) if v in z}
    return d1


def swap_unique_keys_values(d):
    z = []
    for c in list(d.items()):
        if l.count(c[1]) == 1:
            z.append(c[1])
    d1 = {v: k for k, v in list(d.items()) if v in z}
    return d1


def swap_unique_keys_values(d):
    z = []
    for c in list(d.items()):
        if list(d.items()).count(c[1]) == 1:
            z.append(c[1])
    d1 = {v: k for k, v in list(d.items()) if v in z}
    return d1


def swap_unique_keys_values(d):
    z = []
    for c in list(d.items()):
        print(c)
    d1 = {v: k for k, v in list(d.items()) if v in z}
    return d1


def swap_unique_keys_values(d):
    z = []
    for c in list(d.items()):
        print(c[1])
    d1 = {v: k for k, v in list(d.items()) if v in z}
    return d1


def swap_unique_keys_values(d):
    z = []
    for c in list(d.items()):
        z.append(c[1])
    d1 = {v: k for k, v in list(d.items()) if v in z}
    return d1


def swap_unique_keys_values(d):
    d1 = {}
    d2 = {}
    unique = []
    for k in list(d.keys()):
        if k in d:
            d1[k] += 1
        else:
            d1[k] = 1
    for k, v in list(d.items()):
        if d1[k] == 1:
            d2[v] = k
        else:
            continue
    return d2


def swap_unique_keys_values(d):
    d1 = {}
    d2 = {}
    unique = []
    for k in list(d.keys()):
        if k in d1:
            d1[k] += 1
        else:
            d1[k] = 1
    for k, v in list(d.items()):
        if d1[k] == 1:
            d2[v] = k
        else:
            continue
    return d2


def swap_unique_keys_values(d):
    z = []
    l = []
    for c in list(d.items()):
        l.append(c[1])
    for c in l:
        if l.count(c) == 1:
            z.append(c)
    d1 = {v: k for k, v in list(d.items()) if v in z}
    return d1


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d.get(k)
        if v in new_dict:
            del new_dict[v]
        else:
            new_dict[v] = k
    return new_dict


def swap_unique_keys_values(d):
    d1 = {}
    d2 = {}
    unique = []
    for v in list(d.values()):
        if v in d1:
            d1[v] += 1
        else:
            d1[v] = 1
    for k, v in list(d.items()):
        if d1[v] == 1:
            d2[v] = k
        else:
            continue
    return d2


def swap_keys_values(d):
    dic = {}
    for key, value in list(d.items()):
        dic[value] = key
    return dic


def swap_unique_keys_values(d):
    tempd = {}
    alltupps = [(v, k) for k, v in d]
    return alltupps


def swap_unique_keys_values(d):
    global skip
    check = []
    for x in list(d.keys()):
        if d[x] not in check:
            check.append(d[x])
        else:
            skip.append(d[x])
    return skip


def swap_unique_keys_values(d):
    tempd = {}
    alltupps = [(v, k) for k, v in list(d.items())]
    return alltupps


def swap_unique_keys_values(in_dict):
    out_dict = {}
    blacklist = set()
    for k, v in list(in_dict.items()):
        if v in out_dict:
            blacklist.update([v])
            del out_dict[v]
        elif v not in blacklist:
            out_dict[v] = k
    return out_dict


def swap_keys_values(in_dict):
    out_dict = {}
    for k, v in list(in_dict.items()):
        out_dict[v] = k
    return out_dict


def swap_unique_keys_values(d):
    tempd = {}
    alltupps = []
    for k, v in list(d.items()):
        alltupps.append(v, k)
    return alltupps


def swap_unique_keys_values(d):
    tempd = {}
    alltupps = []
    for k, v in list(d.items()):
        alltupps.append((v, k))
    return alltupps


def swap_unique_keys_values(d):
    dic = {}
    for key, value in list(d.items()):
        if value not in dic:
            dic[value] = key
        else:
            del dic[value]
    return dic


def swap_keys_values(swap_me):
    print(list({swap_me[key]: key for key in list(swap_me.keys())}.items()))


def swap_keys_values(swap_me):
    print(list({swap_me[key]: key for key in list(swap_me.keys())}.items())
        .sort(key=lambda x: x[0]))


def swap_keys_values(swap_me):
    o = list({swap_me[key]: key for key in list(swap_me.keys())}.items())
    o.sort(key=lambda x: x[0])
    print(o)


def swap_keys_values(swap_me):
    o = {swap_me[key]: key for key in list(swap_me.keys())}
    o = list(o.items())
    o = list(o)
    o.sort(key=lambda x: x[0])
    print(o)


def swap_keys_values(swap_me):
    if swap_me is not None:
        o = {swap_me[key]: key for key in list(swap_me.keys())}
        o = list(o.items())
        o = list(o)
        o.sort(key=lambda x: x[0])
        print(o)


def swap_keys_values(swap_me):
    if swap_me is not None:
        return {swap_me[key]: key for key in list(swap_me.keys())}


def seen(k, v):
    global skip
    if v in skip:
        return k, v
    else:
        return v, k

def swap_unique_keys_values(d):
    global skip
    check = []
    for x in list(d.keys()):
        if d[x] not in check:
            check.append(d[x])
        else:
            skip.append(d[x])
    d = [seen(k, v) for k, v in list(d.items())]
    print(d)


def swap_unique_keys_values(swap_me):
    if swap_me is not None:
        d = {swap_me[key]: key for key in list(set(swap_me.keys)) if
            swap_me[key]}


def swap_unique_keys_values(swap_me):
    if swap_me is not None:
        d = {swap_me[key]: key for key in list(set(swap_me.keys())) if
            swap_me[key]}


def swap_unique_keys_values(swap_me):
    if swap_me is not None:
        return {swap_me[key]: key for key in list(set(swap_me.keys())) if
            swap_me[key]}


def swap_keys_values(d):
    d = {v: k for k, v in list(d.items())}
    return d


def swap_unique_keys_values(d):
    d = {v: k for k, v in list(d.items())}
    return d


def swap_unique_keys_values(swap_me):
    if swap_me is not None:
        return {swap_me[key]: key for key in list(swap_me.keys()) if list(
            swap_me.values()).count(swap_me[key]) == 1}


def swap_unique_keys_values(d):
    tempd = {}
    alltupps = []
    newlist = []
    for k, v in list(d.items()):
        alltupps.append((v, k))
    alltupps = sorted(alltupps)
    i = 0
    while i < len(alltupps) - 1:
        if alltupps[i][0] != alltupps[i + 1][0]:
            newlist.append(alltupps[i])
        else:
            i += 1
        i += 1
    if alltupps[-2][0] != alltupps[-1][0]:
        newlist.append(alltupps[-1])
    return dict(newlist)


def swap_keys_values(x):
    new_d = dict((v, k) for k, v in list(x.items()))
    return new_d


def swap_unique_keys_values(d):
    store = {}
    value = []
    va = list(d.values())
    for i in va:
        value.append(i)
    for k, v in list(d.items()):
        if value.count(v) == 1:
            store[k] = v
    return {v: k for k, v in list(store.items())}


def swap_keys_values(d):
    return {v: k for k, v in list(d.items())}


def swap_unique_keys_values(d):
    return dict([(v, k) for k, v in list(d.items()) if list(d.values()).
        count(v) == 1])


def swap_unique_keys_values(d):
    keys = [k for k in list(d.keys())]
    vals = [v for v in list(d.values())]
    dd = {}
    for i in range(0, len(vals)):
        if vals.count(vals[i]) == 1:
            dd[keys[i]] = vals[i]
    return dd


def swap_unique_keys_values(d):
    keys = [k for k in list(d.keys())]
    vals = [v for v in list(d.values())]
    dd = {}
    for i in range(0, len(vals)):
        if vals.count(vals[i]) == 1:
            dd[vals[i]] = keys[i]
    return dd


def swap_keys_values(d):
    new_dict = dict([(v, k) for k, v in list(d.items())])
    return new_dict


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d[k]
        if v not in new_dict:
            new_dict[v] = k
        else:
            del new_dict[v]
    return new_dict


def swap_unique_keys_values(d):
    new_dict = {}
    values = []
    keys = []
    for z, q in list(d.items()):
        keys.append(q)
        values.append(z)
    for z, q in list(d.items()):
        if not keys.count(q) > 1:
            new_dict[q] = z
    return new_dict


def swap_keys_values(d):
    new_dict = {}
    for z, q in list(d.items()):
        new_dict[q] = z
    return new_dict


def swap_unique_keys_values(a):
    value = list(a.values())
    keys = list(a.keys())
    dir = {}
    for i in a:
        if values.count(value[i]) < 2:
            dir[value[i]] = keys[i]
    return dir


def swap_unique_keys_values(a):
    value = list(a.values())
    keys = list(a.keys())
    dir = {}
    for i in a:
        if value.count(value[i]) < 2:
            dir[value[i]] = keys[i]
    return dir


def swap_unique_keys_values(a):
    value = list(a.values())
    keys = list(a.keys())
    dir = {}
    for i in range(0, len(vaules)):
        if value.count(value[i]) < 2:
            dir[value[i]] = keys[i]
    return dir


def swap_unique_keys_values(a):
    value = list(a.values())
    keys = list(a.keys())
    dir = {}
    for i in range(0, len(value)):
        if value.count(value[i]) < 2:
            dir[value[i]] = keys[i]
    return dir


def swap_keys_values(d):
    new_d = {}
    for key, val in d:
        new_d[val] = key
    return new_d


def swap_keys_values(d):
    new_d = {}
    for key, val in d.items:
        new_d[val] = key
    return new_d


def swap_keys_values(d):
    new_d = {}
    for key, val in list(d.items()):
        new_d[val] = key
    return new_d


def swap_unique_keys_values(d):
    new_d = {}
    dups = []
    for key, val in list(d.items()):
        if val not in dups:
            new_d[val] = key
            dups.append(val)
        else:
            del new_d[val]
    return new_d


def swap_unique_keys_values(d):
    new_dict = dict()
    for k in d:
        v = d.get[k]
        if v in new_dict:
            del new_dict[v]
        else:
            new_dict[v] = k
    return new_dict


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d.get(k)
        if v in new_dict:
            del new_dict[v]
        else:
            new_dict[v] = k
    return new_dict


def swap_unique_keys_values(d):
    seen = []
    return {v: k for k, v in list(d.items())}


def swap_unique_keys_values(d):
    values = list(d.values())
    return {v: k for k, v in list(d.items()) if values.count(v) < 2}


def swap_keys_values(d):
    return {k: v for v, k in list(d.items())}


def swap_unique_keys_values(d):
    values = list(d.values())
    items = [(y, x) for x, y in list(d.items())]
    d2 = {v: k for v, k in sorted(items) if values.count(v) == 1}
    return d2


def swap_keys_values(d):
    e = {}
    for k, v in d:
        e[v] = k
    return e


def swap_keys_values(d):
    e = {}
    for k, v in list(d.items()):
        e[v] = k
    return e


def swap_keys_values(d):
    d = dict((v, k) for k, v in d.items())


def swap_keys_values(d):
    return dict((v, k) for k, v in d.items())


def swap_keys_values(d):
    return {(v, k) for k, v in d.items()}


def swap_keys_values(d):
    print(dict((v, k) for k, v in d.items()))


def swap_keys_values(d):
    print(dict((v, k) for k, v in list(d.items())))


def swap_keys_values(d):
    new_dict = dict([(v, k) for k, v in list(d.items())])
    return new_dict


def swap_unique_keys_values(d):
    return dict([(v, k) for k, v in list(d.items()) if list(d.values()).
        count(v) == 1])


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print(list(d.items()))


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d[k]
        if v not in new_dict:
            new_dict[v] = k
        else:
            del new_dict[v]
    return new_dict


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    list(d.items())


def swap_keys_values(d):
    return {d[key]: key for key in d}


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print(sorted(list(d.items())))


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print(collections.OrderedDict(sorted(list(d.items()), key=lambda t: t[0])))


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    d = collections.OrderedDict(sorted(list(d.items()), key=lambda t: t[0]))
    print(d)


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    d = collections.OrderedDict(sorted(list(d.items()), key=lambda t: t[0]))
    print(list(d.items()))


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    d = sorted(list(d.items()), key=lambda t: t[0])
    print(list(d.items()))


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    d = SortedDict(d)
    print(d.items)


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print(sorted(d.items()))


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print(sorted(list(d.items()), key=sorter))


def swap_unique_keys_values(d):
    a = [v for k, v in list(d.items())]
    for i in a:
        if a.count(i) == 1:
            a.pop(i)
    e = {}
    for k, v in list(d.items()):
        if v not in a:
            e[v] = k
    return e


def swap_unique_keys_values(d):
    a = [v for k, v in list(d.items())]
    for i in a:
        if a.count(i) == 1:
            a.remove(i)
    e = {}
    for k, v in list(d.items()):
        if v not in a:
            e[v] = k
    return e


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    d = list(d.items())
    print(d)


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print(d)


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print([k for k, v in sorted(list(d.items()), key=lambda x: x[1],
        reverse=True)])


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print([k for k, v in sorted(list(d.items()), key=lambda x: x[1])])


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print(sorted(list(d.items()), key=lambda x: x[1]))


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print([(k, v) for k, v in sorted(list(d.items()), key=lambda x: x[1])])


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    sd = sorted(d.items())
    print(sd)


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print(sorted(d))


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    d = sorted(d)
    print(d)


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    d = sorted(list(d.items()), key=lambda t: t[0])
    print(d)


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    new_dict = sorted(list(d.items()), key=lambda t: t[0])
    print(new_dict)


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    new_dict = sorted(list(d.items()), key=lambda t: t[0])
    return new_dict


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print(new_dict)


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))
    print(sorted(list(d.items()), key=lambda t: t[0]))


def swap_keys_values(d):
    d = dict((v, k) for k, v in list(d.items()))


def swap_keys_values(d):
    new_dict = dict((v, k) for k, v in list(d.items()))


def swap_keys_values(d):
    new_dict = dict((v, k) for k, v in list(d.items()))
    return new_dict


def swap_keys_values(d):
    new_dict = dict([(v, k) for k, v in list(d.items())])
    return new_dict


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d.get(k)
        if v in new_dict:
            del new_dict[v]
        else:
            new_dict[v] = k
    return new_dict


def swap_unique_keys_values(d):
    a = [v for k, v in list(d.items())]
    for i in a:
        if 1 < a.count(i):
            a.remove(i)
    e = {}
    for k, v in list(d.items()):
        if v in a:
            e[v] = k
    return e


def swap_keys_values(d):
    new_d = d((v, k) for k, v in list(d.items()))
    return new_d


def swap_unique_keys_values(d):
    a = [v for k, v in list(d.items())]
    for i in a:
        if 1 < a.count(i):
            a = [j for j in a if j != i]
    e = {}
    for k, v in list(d.items()):
        if v in a:
            e[v] = k
    return e


def swap_unique_keys_values(d):
    new_dict = dict((v, k) for k, v in list(d.items()))
    return new_dict


def swap_keys_values(d):
    d = {v: k for k, v in list(d.items())}
    return d


def swap_unique_keys_values(d):
    keys = [k for k in list(d.keys())]
    vals = [v for v in list(d.values())]
    dd = {}
    for i in range(0, len(vals)):
        if vals.count(vals[i]) == 1:
            dd[vals[i]] = keys[i]
    return dd


def swap_unique_keys_values(d):
    new_dict = dict((v, k) for k, v in list(d.items()))
    new_dict.pop(7, None)
    return new_dict


def swap_keys_values(d):
    new_dict = dict((k, v) for k, v in list(d.items()))
    return new_dict


def swap_keys_values(my_dict):
    new_dict = {}
    new_dict = {v: k for k, v in list(my_dict.items())}
    return new_dict


def swap_keys_values(d):
    for c in d:
        tmp == d[key]
        d[key] == value
        value == tmp
    return d


def swap_keys_values(d):
    tmp = ''
    for c in d:
        tmp = d[key]
        d[key] = value
        value = tmp
    return d


def swap_keys_values(d):
    new_dict = dict([(v, k) for k, v in list(d.items())])
    return new_d


def swap_unique_keys_values(d):
    c = {}
    e = {}
    r = {}
    seen = {}
    for value in list(d.values()):
        if value not in c:
            c[value] = 1
        else:
            c[value] = c[value] + 1
    for keys, values in list(c.items()):
        if values == 2:
            e.append(keys)
            del values
    for key in e:
        for value in list(d.items()):
            if key not in value:
                r[value[0]] = value[1]
    my_dict = r
    new_dict = {v: k for k, v in list(my_dict.items())}
    return new_dict


def swap_unique_keys_values(d):
    c = {}
    e = []
    r = {}
    seen = {}
    for value in list(d.values()):
        if value not in c:
            c[value] = 1
        else:
            c[value] = c[value] + 1
    for keys, values in list(c.items()):
        if values == 2:
            e.append(keys)
            del values
    for key in e:
        for value in list(d.items()):
            if key not in value:
                r[value[0]] = value[1]
    my_dict = r
    new_dict = {v: k for k, v in list(my_dict.items())}
    return new_dict


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d[k]
        if v not in new_dict:
            new_dict[v] = k
        else:
            del new_dict[v]
        return new_dict


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d[k]
        if v not in new_dict:
            new_dict[v] = k
        else:
            del new_dict[v]
    return new_dict


def swap_keys_values(d):
    swapped = {}
    for k, v in list(d.items()):
        swapped[v] = k
    return swapped


def swap_unique_keys_values(d):
    a = [v for k, v in d.items]
    b = [c for c in a if a.count(c) == 1]
    return {v: k for k, v in list(d.items()) if v in b}


def swap_unique_keys_values(d):
    a = [v for k, v in list(d.items())]
    b = [c for c in a if a.count(c) == 1]
    return {v: k for k, v in list(d.items()) if v in b}


def swap_unique_keys_values(d):
    new_dict = {}
    for k in d:
        v = d.get(k)
        if v in new_dict:
            del new_dict[v]
        else:
            new_dict[v] = k
    return new_dict


def swap_keys_values():
    a = [v for k, v in list(d.items())]
    return {v: k for k, v in list(d.items())}


def swap_keys_values(d):
    a = [v for k, v in list(d.items())]
    return {v: k for k, v in list(d.items())}


def swap_unique_keys_values(d):
    n_d = {}
    dup = []
    for k in d:
        if k in n_d:
            dup.append(k)
        n_d[d[k]] = k
    for d in dup:
        n_d.pop(d)
    return n_d


def swap_unique_keys_values(d):
    print(d)
    n_d = {}
    dup = []
    for k in d:
        if k in n_d:
            dup.append(k)
        n_d[d[k]] = k
    print(dup)
    for d in dup:
        n_d.pop(d)
    return n_d


def swap_unique_keys_values(d):
    print(d)
    n_d = {}
    dup = []
    for k in d:
        if d[k] in n_d:
            dup.append(k)
        n_d[d[k]] = k
    print(dup)
    for x in dup:
        n_d.pop(x)
    return n_d


def swap_unique_keys_values(d):
    print(d)
    n_d = {}
    dup = []
    for k in d:
        if d[k] in n_d:
            dup.append(d[k])
        n_d[d[k]] = k
    print(dup)
    for x in dup:
        n_d.pop(x)
    return n_d


def swap_unique_keys_values(d):
    n_d = {}
    dup = []
    for k in d:
        if d[k] in n_d:
            dup.append(d[k])
        n_d[d[k]] = k
    for x in dup:
        n_d.pop(x)
    return n_d


def swap_keys_values(d):
    return {v: k for k, v in list(d.items())}


def swap_keys_values(d):
    for k, v in d.items:
        new_v, new_k = k, v
        return new_v, new_k


def swap_unique_keys_values(d):
    a = []
    for k, v in d.items:
        a.append(v)
    b = [c for c in a if a.count(c) == 1]
    return {v: k for k, v in list(d.items()) if v in b}


def swap_unique_keys_values(d):
    a = []
    for k, v in list(d.items()):
        a.append(v)
    b = [c for c in a if a.count(c) == 1]
    return {v: k for k, v in list(d.items()) if v in b}


def swap_keys_values(x):
    d = {}
    for k, v in list(x.items()):
        d[v] = k
    return d


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2

Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.


Test if two circles overlap.


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    if not l2:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=1):
    d = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    rd = r1 + r2
    if d < rd:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=[]):
    return l1 + l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    print(distance)
    if distance >= r1 + r2:
        return False
    return True

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    if distance >= r1 + r2:
        return False
    return True

Test if two circles overlap.


def append2list(l1, l2=[]):
    if l2 is None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    return l2 + l1


def append2list(l1, l2=''):
    if l2 == '':
        l2 = []
        for i in l1:
            l2.append(i)
    return l2


def append2list(l2, l1=None):
    if l1 == None:
        l1 = []
    for i in l2:
        l1.append(i)
    return l1


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    if r1 + r2 < distance:
        return False
    else:
        return True

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    A = False
    sumrad = r1 + r2
    xs = (x2 - x1) ** 2
    ys = (y2 - y1) ** 2
    inside = xs + ys
    dis = math.sqrt(inside)
    if dis < sumrad:
        return True
    elif sumrad < dis:
        return A
    elif sumrad == dis:
        return A

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    if r1 + r2 <= distance:
        return False
    else:
        return True

Test if two circles overlap.


def append2list(l1, l2=''):
    if l2 == '':
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    if l2 == None:
        l2 == []
    for i in l1:
        l2.append(i)
    return l2


Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=1, y2=1, r2=1):
    distance_centre = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    distance_radius = (r1 + r2) * (r1 + r2)
    if distance_centre < distance_radius:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    if l2 == '':
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    if l2 == ' ':
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) * (x2 - x1)
    y = (y2 - y1) * (y2 - y1)
    xy = x + y
    D = math.sqrt(xy)
    if D >= r1 + r2:
        print(False)
    else:
        print(True)

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=1):
    d = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    rd = r1 + r2
    if d < rd:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
        for i in l1:
            l2.append(i)
    else:
        for i in l1:
            l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) * (x2 - x1)
    y = (y2 - y1) * (y2 - y1)
    xy = x + y
    D = math.sqrt(xy)
    if D >= r1 + r2:
        return False
    else:
        return True

Test if two circles overlap.


def append2list(l1, l2=[]):
    for i in l2:
        l1.append(i)
    return l1


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    from math import sqrt
    dist = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    print(dist < r1 + r2)

Test if two circles overlap.


def append2list(l1, l2=[]):
    for i in l2[::-1]:
        l1.append(i)
    return l1


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    return l2 + l1


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    from math import sqrt
    print((x1, y1, r1, x2, y2, r2))
    dist = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    print(dist < r1 + r2)

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    return l1 + l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    if distance >= r1 + r2:
        return False
    return True

Test if two circles overlap.


Test if two circles overlap.


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    l1 = l1.clear()
    return l2


def append2list(l1=[], l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    from math import sqrt
    dist = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    return dist < r1 + r2

Test if two circles overlap.


def append2list(d1=[], d2=[]):
    for i in d1:
        d2.append(i)
    return d2


def append2list(l1=[], l2=[]):
    return l2 + l1


def append2list(l1, l2=[]):
    if l2:
        for i in l1:
            l2.append(i)
        return l2
    else:
        return l1


def overlap(x1=0, y1=0, r1=1, x2=1, y2=1, r2=1):
    distance_centre = int(sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2))
    distance_radius = r1 + r2
    if distance_centre < distance_radius:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
        for i in l1:
            l2.append(i)
        return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = x2 - x1
    y = y2 - y1
    r = r1 + r2
    distance = (x * x + y * y) ** 0.5
    return r > distance

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = x2 - x1
    y = y2 - y1
    r = r1 + r2
    hypotenuse = (x ** 2 + y ** 2) ** 0.5
    return r > hypotenuse

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2:
        for i in l1:
            l2.append(i)
        return l2
    else:
        return l1


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=0):
    circles = (x2 - x1) ** 2 + (y2 - y1) ** 2
    distance = circles ** 1 / 2
    length = r1 + r2
    if distance <= length:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1, y1, r1, x2, y2, r2):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) // 2
    if r1 + r2 == distance:
        return True
    elif r1 - r2 == distance:
        return True
    else:
        return False

Test if two circles overlap.


_A = None

def overlap(x1=_A, y1=_A, r1=_A, x2=_A, y2=_A, r2=_A):
    if x1 is _A:
        x1 = 0
    if x2 is _A:
        x2 = 0
    if r1 is _A:
        r1 = 1
    if y2 is _A:
        y2 = 0
    if y1 is _A:
        y1 = 0
    if r2 is _A:
        r2 = 1
    if (x2 - x1) ** 2 + (y2 - y1) ** 2 >= (r1 + r2) ** 2:
        return False
    else:
        return True

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    circles = (x2 - x1) ** 2 + (y2 - y1) ** 2
    distance = circles ** 1 / 2
    length = r1 + r2
    if distance < length:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) // 2
    if r1 + r2 == distance:
        return True
    elif r1 - r2 == distance:
        return True
    else:
        return False

Test if two circles overlap.


Test if two circles overlap.


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) // 2
    print(diatance)
    print(r1)
    print(r2)
    if r1 + r2 == distance:
        return True
    elif r1 - r2 == distance:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=0):
    dist_p = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** (1 / 2)
    dist_r = r1 + r2
    if dist_p < dist_r:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) // 2
    print(distance)
    print(r1)
    print(r2)
    if r1 + r2 == distance:
        return True
    elif r1 - r2 == distance:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1, y1, r1, x2, y2, r2):
    dist_p = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** (1 / 2)
    dist_r = r1 + r2
    if dist_p < dist_r:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=0):
    dist_p = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** (1 / 2)
    dist_r = r1 + r2
    if dist_p <= dist_r:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = (x + y) // 2
    print(distance)
    print(r1)
    print(r2)
    if r1 + r2 == distance:
        return True
    elif r1 - r2 == distance:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = (x + y) // 2
    print(distance)
    print(r1 + r2)
    print(r1 - r2)
    if r1 + r2 == distance:
        return True
    elif r1 - r2 == distance:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for item in l1:
        l2.append(item)
    return l2


def overlap(x1, y1, r1, x2, y2, r2):
    d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    r = r1 + r2
    if d >= r:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = (x + y) // 2
    if r1 + r2 == distance:
        return True
    elif r1 - r2 == distance:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=''):
    if l2 == '':
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    print('{} {} {} {} {} {}'.format(x1, y1, r1, x2, y2, r2))
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = (x + y) // 2
    if r1 + r2 == distance:
        return True
    elif r1 - r2 == distance:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    circles = (x2 - x1) ** 2 + (y2 - y1) ** 2
    distance = math.sqrt(circles)
    length = r1 + r2
    if distance < length:
        return True
    else:
        return False

Test if two circles overlap.


Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = (x + y) // 2
    if r1 + r2 == distance or r1 - r2 == distance:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=0):
    dist_p = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    dist_r = r1 + r2
    if dist_p < dist_r:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = (x + y) // 2
    if r1 + r2 == distance or r2 - r1 == distance:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = (x + y) // 2
    if r1 + r2 == distance or abs(r1 - r2) == distance:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    l2.append(l1)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    rpos = r1 + r2
    rneg = r1 - r2
    if d == rpos:
        return True
    elif d != rneg:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = abs((x2 - x1) ** 2)
    y = abs((y2 - y1) ** 2)
    distance = (x + y) // 2
    if r1 + r2 == distance or abs(r1 - r2) == distance:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    rpos = r1 + r2
    rneg = r1 - r2
    if d == rpos:
        return True
    elif d == rneg:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(l1)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    if r1 + r2 == distance or abs(r1 - r2) == distance:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    if r1 + r2 == distance or abs(r1 - r2) == distance and distance < r1 + r2:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    if r1 + r2 == distance or abs(r1 - r2) == distance and distance <= r1 + r2:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    rpos = r1 + r2 - 1
    rneg = r1 - r2 + 1
    if d == rpos:
        return True
    elif d == rneg:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    rpos = r1 + r2 - 1
    rneg = r1 - r2
    if d == rpos:
        return True
    elif d == rneg:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    if (r1 + r2 == distance or abs(r1 - r2) == distance
        ) and distance <= r1 + r2 - 1:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    if (r1 + r2 == distance or abs(r1 - r2) == distance
        ) and distance == r1 + r2 - 1:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    if (r1 + r2 == distance or abs(r1 - r2) == distance
        ) and distance == r1 + r2:
        return True
    else:
        return False

Test if two circles overlap.


Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    if (r1 + r2 == distance or abs(r1 - r2) == distance
        ) and distance <= r1 + r2:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    if r1 + r2 - 1 == distance or abs(r1 - r2) == distance:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    if r1 + r2 - 1 == distance or abs(r1 - r2 + 1) == distance:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    if r1 + r2 - 1 == distance or abs(r1 - r2 - 1) == distance:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    return l2 + l1


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
        print(l2)
    return l2


def append2list(l1, l2=None):
    if l2 is None:
        ls = []
    for i in l1:
        l2.append(i)
        print(l2)
    return l2


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    for i in l1:
        l2.append(i)
        print(l2)
    return l2


_A = None

def overlap(x1=_A, y1=_A, r1=_A, x2=_A, y2=_A, r2=_A):
    if (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) < (r1 + r2) * (r1 + r2):
        return True
    else:
        return False

Test if two circles overlap.


_A = None

def overlap(x1=_A, y1=_A, r1=_A, x2=_A, y2=_A, r2=_A):
    if x1 is _A:
        x1 = 0
    elif y1 is _A:
        y1 = 0
    elif r1 is _A:
        r1 = 1
    if (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) < (r1 + r2) * (r1 + r2):
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    rdistance = r1 + r2
    cdistance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    if cdistance < rdistance:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if not l2:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    if l2:
        for i in l1:
            l2.append(i)
        return l2
    else:
        return l1


def append2list(l1, l2=None):
    l2 = l2 or []
    for i in l1:
        l2.append(i)
    return l2


def distance(x1, y1, x2, y2):
    return math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)

def overlap(x1=0, y1=0, r1=1, x2=0, y=0, r2=1):
    return distance(x1, y1, x2, y2) < r1 + r2

Test if two circles overlap.


def distance(x1, y1, x2, y2):
    return math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)

def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    return distance(x1, y1, x2, y2) < r1 + r2

Test if two circles overlap.


Test if two circles overlap.


_A = None

def overlap(x1=_A, y1=_A, r1=_A, x2=_A, y2=_A, r2=_A):
    if x1 is _A:
        x1 = 0
    if y1 is _A:
        y1 = 0
    if r1 is _A:
        r1 = 1
    if x2 is _A:
        x2 = 0
    if y2 is _A:
        y2 = 0
    if r2 is _A:
        r2 = 1
    c = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    if c > r1:
        return False
    else:
        return True

Test if two circles overlap.


_A = None

def overlap(x1=_A, y1=_A, r1=_A, x2=_A, y2=_A, r2=_A):
    if x1 is _A:
        x1 = 0
    if y1 is _A:
        y1 = 0
    if r1 is _A:
        r1 = 1
    if x2 is _A:
        x2 = 0
    if y2 is _A:
        y2 = 0
    if r2 is _A:
        r2 = 1
    c = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    if c > r1 or c > r2:
        return False
    else:
        return True

Test if two circles overlap.


_A = None

def overlap(x1=_A, y1=_A, r1=_A, x2=_A, y2=_A, r2=_A):
    if x1 is _A:
        x1 = 0
    if y1 is _A:
        y1 = 0
    if r1 is _A:
        r1 = 1
    if x2 is _A:
        x2 = 0
    if y2 is _A:
        y2 = 0
    if r2 is _A:
        r2 = 1
    c = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    if c > r1 and c > r2:
        return False
    else:
        return True

Test if two circles overlap.


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def remove_zeros(list):
    while 0 in list:
        list.remove(0)

assert remove_zeros([])==None and remove_zeros([])==None and remove_zeros([5202, -24344, -6528])==None and remove_zeros([5202, -24344, -6528])==None

Take a list of numbers and removes the zeros from it.


def merge_lists(l1, l2):
    l3 = []
    i = 0
    while i < len(l1):
        l3.append(l1[i])
        i += 2
    i = 0
    while i < len(l2):
        l3.append(l2[i])
        i += 2
    return l3

Take two lists l1 and l2 and return a third list which contains every second element of l1 and l2.


def weird_case(some_str):
    new_str = ''
    i = 0
    lc = 0
    while i < len(some_str):
        if some_str[i].isalpha():
            if lc % 2 == 0:
                new_str += some_str[i].upper()
            else:
                new_str += some_str[i].lower()
            lc += 1
        else:
            new_str += some_str[i]
        i = i + 1
    return new_str

assert weird_case('au0x6')==Au0X6 and weird_case('F:BnJ')==F:bNj

Takes a string some_str and contains a new string which is the same as some_str but the case alternates between upper and lower.


def print_keys(dict):
    for key in dict:
        print(key)

assert print_keys({})==None and print_keys({})==None and print_keys({'1': 'a'})==None and print_keys({'1': 'a'})==None and print_keys({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})==None and print_keys({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})==None and print_keys({'key1': 'a', 'key2': 'b', 'key3': 'a'})==None and print_keys({'key1': 'a', 'key2': 'b', 'key3': 'a'})==None

Print all the keys in a dictionary, one per line.


def distance_between_points(x1, y1, x2, y2):
    return sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)

def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = distance_between_points(x1, y1, x2, y2)
    return distance < r1 + r2

Test if two circles overlap.


def overlap(x1, y1, r1, x2, y2, r2):
    dist = math.sqrt(x2 - x1) ** 2 + (y2 - y1) ** 2
    if dist < r1 + r2:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    if math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) < r1 + r2:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    dist = ((x2 - x1) ** 2) ** 0.5 + (y2 - y1) ** 2
    if dist < r1 + r2:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    dist = (x2 - x1) ** 2 + (y2 - y1) ** 2
    dist2 = dist ** 0.5
    if dist2 < r1 + r2:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(w, alist=[]):
    alist.append(w)
    return alist


def append2list(l1, l2=None):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    for i in l1:
        if l2 is None:
            l2 = []
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=0):
    dist_p = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** (1 / 2)
    dist_r = r1 + r2
    if dist_p < dist_r:
        return True
    else:
        return False

Test if two circles overlap.


Test if two circles overlap.


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=0):
    dist_p = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** (1 / 2)
    dist_r = (r1 + r2) ** 2
    if dist_p < dist_r:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=0):
    dist_p1 = (x2 - x1) ** 2
    dist_p2 = (y2 - y1) ** 2
    dist_p = (dist_p1 + dist_p2) ** (1 / 2)
    dist_r = r1 + r2
    if dist_p < dist_r:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    rad = (r1 + r2) ** 2
    xs = (x1 - x2) ** 2
    ys = (y1 - y2) ** 2
    both_x_y = xs + ys
    if rad > both_x_y:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance_centre = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    distance_radius = r1 + r2
    return distance_radius > distance_centre

Test if two circles overlap.


def append2list(l1, l2=None):
    l2 = l2 or []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=1):
    distanceX = x1 - x2
    distanceY = y1 - y2
    radiusSum = circle.Radius + Radius
    return (distanceX * distanceX + distanceY * distanceY <= radiusSum *
        radiusSum)

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=1):
    distanceX = x1 - x2
    distanceY = y1 - y2
    radiusSum = r1 + r2
    return (distanceX * distanceX + distanceY * distanceY <= radiusSum *
        radiusSum)

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=1):
    distanceX = x1 - x2
    distanceY = y1 - y2
    radiusSum = r1 + r2
    print((x1, x2, y1, y2, r1, r2))
    return (distanceX * distanceX + distanceY * distanceY <= radiusSum *
        radiusSum)

Test if two circles overlap.


def append2list(l1, l2=[]):
    l = l2
    for i in l1:
        l.append(i)
    return l


def append2list(l1, l2=[]):
    l = []
    l = l2
    for i in l1:
        l.append(i)
    return l


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l.append(i)
    return l


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    dis = ((x1 - x2) ** 2 + (y1 + y2) ** 2) ** 0.5
    if r1 + r2 > dis and dis != 0:
        return True
    elif dis == 0 and r1 == r2:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    dis = ((x1 - x2) ** 2 + (y1 + y2) ** 2) ** 0.5
    if r1 + r2 >= dis and dis != 0:
        return True
    elif dis == 0 and r1 == r2:
        return True
    else:
        return False

Test if two circles overlap.


Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    dis = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
    if r1 + r2 > dis and dis != 0:
        return True
    elif dis == 0 and r1 == r2:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    dis = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
    if r1 + r2 >= dis and dis != 0:
        return True
    elif dis == 0 and r1 == r2:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    a = sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
    if a >= r1 + r2:
        return False
    else:
        return True

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
        for i in l1:
            l2.append(i)
    return l2


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    else:
        for i in l1:
            l2.append(i)
    return l2


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
        for i in l1:
            l2.append(i)
    else:
        for i in l1:
            l2.append(i)
    return l2


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    overlap = False
    if R0 - R1 <= x0 - x1 + (y0 - y1) < R0 + R1:
        overlap = True
    return overlap

Test if two circles overlap.


def append2list(l1, l2=[]):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    overlap = False
    if R0 - R1 <= x0 - x1 + (y0 - y1) or x0 + x1 + (y0 + y1) < R0 + R1:
        overlap = True
    return overlap

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    overlap = False
    if R0 - R1 <= x0 - x1 + (y0 - y1) or x0 - x1 + (y0 - y1) < R0 + R1:
        overlap = True
    return overlap

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    overlap = False
    if sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2) < R0 + R1:
        overlap = True
    return overlap

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    overlap = False
    if math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2) < R0 + R1:
        overlap = True
    return overlap

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    overlap = False
    if math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2) <= R0 + R1:
        overlap = True
    return overlap

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    rad = (r1 + r2) ** 2
    xs = (x1 - x2) ** 2
    ys = (y1 - y2) ** 2
    both_x_y = xs + ys
    if rad > both_x_y:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    A = False
    try:
        overlap = A
        if math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2) < R0 + R1:
            overlap = True
        return overlap
    except KeyError:
        print(A)

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    try:
        overlap = False
        if math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2) < R0 + R1:
            overlap = True
        return overlap
    except KeyError:
        print(True)

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    A = False
    try:
        overlap = A
        if math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2) < R0 + R1:
            overlap = True
        return overlap
    except TypeError:
        print(A)

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    try:
        overlap = False
        if math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2) < R0 + R1:
            overlap = True
        return overlap
    except TypeError:
        print(True)

Test if two circles overlap.


Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    if r1 + r2 - 1 == distance or abs(r1 - r2) == distance:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    A = False
    try:
        overlap = A
        if math.sqrt((int(x0) - int(x1)) ** 2 + (int(y0) - int(y1)) ** 2
            ) < int(R0) + int(R1):
            overlap = True
        return overlap
    except TypeError:
        print(A)

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    return r1 + r2 < distance

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    A = False
    try:
        overlap = True
        if math.sqrt((int(x0) - int(x1)) ** 2 + (int(y0) - int(y1)) ** 2
            ) < int(R0) + int(R1):
            overlap = A
        return overlap
    except TypeError:
        print(A)

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    x = (x2 - x1) ** 2
    y = (y2 - y1) ** 2
    distance = sqrt(x + y)
    return r1 + r2 > distance

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    A = False
    try:
        overlap = A
        if math.sqrt((int(x1) - int(x0)) ** 2 + (int(y1) - int(y0)) ** 2
            ) < int(R0) + int(R1):
            overlap = True
        return overlap
    except TypeError:
        print(A)

Test if two circles overlap.


def overlap(x0=0, y0=0, R0=1, x1=0, y1=0, R1=1):
    try:
        overlap = False
        if math.sqrt((int(x1) - int(x0)) ** 2 + (int(y1) - int(y0)) ** 2
            ) < int(R0) + int(R1):
            overlap = True
        return overlap
    except TypeError:
        pass

Test if two circles overlap.


def append2list(l1, l2=[]):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    try:
        overlap = False
        if math.sqrt((x1 - x0) ** 2 + (y1 - y0) ** 2) < R0 + R1:
            overlap = True
        return overlap
    except TypeError:
        pass

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    try:
        overlap = False
        if math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) < r1 + r2:
            overlap = True
        return overlap
    except TypeError:
        pass

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    overlap = False
    if math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) < r1 + r2:
        overlap = True
    return overlap

Test if two circles overlap.


def append2list(l1, l2=[]):
    empty = []
    for i in l2:
        empty.append(i)
    for i in l1:
        empty.append(i)
    return empty


def append2list(l1, l2=[][:]):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[][:]):
    return l1 + l2


def append2list(l1, l2=[][:]):
    return l2 + l1


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** (1 / 2)
    circles = r1 + r2
    if distance < circles:
        print(True)
    else:
        print(False)

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** (1 / 2)
    circles = r1 + r2
    if distance < circles:
        return True
    else:
        return False

Test if two circles overlap.


Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = (x1 - x2) ** 2 + (y1 - y2) ** 2
    if (r1 + r2) ** 2 > distance:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    rpos = r1 + r2 - 1
    rneg = r1 - r2
    if d == rpos:
        return True
    elif d == rneg:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    if not l2:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    if float(r1) > distance - r2 and float(r2) > distance - r1:
        return True
    else:
        return False

Test if two circles overlap.


def merge_lists(l1, l2):
    l3 = []
    i = 0
    while i < len(l1):
        l3.append(l1[i])
        i += 2
    i = 0
    while i < len(l2):
        l3.append(l2[i])
        i += 2
    return l3


def weird_case(some_str):
    new_str = ''
    i = 0
    lc = 0
    while i < len(some_str):
        if some_str[i].isalpha():
            if lc % 2 == 0:
                new_str += some_str[i].upper()
            else:
                new_str += some_str[i].lower()
            lc += 1
        else:
            new_str += some_str[i]
        i = i + 1
    return new_str


def remove_zeros(list):
    while 0 in list:
        list.remove(0)


def merge_lists(l1, l2):
    l3 = []
    i = 0
    while i < len(l1):
        l3.append(l1[i])
        i += 1
    i = 0
    while i < len(l2):
        l3.append(l2[i])
        i += 1
    return l3


def append2list(l1, l2=[]):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    if l2 != None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    if l2 != None:
        if len(l2) > 1:
            l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    if len(l2) > 1:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2):
    for i in l1:
        l2.append(i)
    return l2
    if l2 is None:
        l2 = []


def append2list(l1, l2):
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    sumofradi = r1 + r2
    return distance < sumofradi

Test if two circles overlap.


Test if two circles overlap.


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    else:
        l2 = l2
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 1 / 2
    total_radius = r1 + r2
    if distance < total_radius:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    total_radius = r1 + r2
    print((x1, y1, r1, x2, y2, r2))
    print((total_radius, distance))
    if distance < total_radius:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    total_radius = r1 + r2
    if distance < total_radius:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = (abs((x2 - x1) ** 2) + abs((y2 - y1) ** 2)) ** 0.5
    if r1 + r2 > distance and abs(r1 - r2) <= distance:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = (abs((x2 - x1) ** 2) + abs((y2 - y1) ** 2)) ** 0.5
    if r1 + r2 > distance:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=0):
    if x1 == x2 and y1 == y2 and r1 == r2:
        return True
    distance = (x2 - x1 + (y2 - y1)) ** 0.5
    if abs(distance) < r1 or abs(distance) < r2:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=0):
    A = True
    if x1 == x2 and y1 == y2 and r1 == r2:
        return A
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    if abs(distance) <= r1:
        return A
    if abs(distance) <= r2:
        return A
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    item1 = (x2 - x1) ** 2
    item2 = (y2 - y1) ** 2
    item3 = item1 + item2
    distance = item3 ** (1 / 2)
    radiusd = r1 + r2
    if distance < radiusd:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    hypotenuse = ((x2 - x1) ** 2 + (y2 - x1) ** 2) ** 0.5
    if hypotenuse > r1 + r2:
        return False
    else:
        return True

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    hypotenuse = ((x2 - x1) ** 2 + (y2 - x1) ** 2) ** 0.5
    if hypotenuse >= r1 + r2:
        return False
    else:
        return True

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    hypotenuse = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    if hypotenuse > r1 + r2:
        return False
    else:
        return True

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    hypotenuse = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    if hypotenuse >= r1 + r2:
        return False
    else:
        return True

Test if two circles overlap.


Test if two circles overlap.


def append2list(l1, l2=[]):
    l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2):
    l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1):
    l2 = []
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2='none'):
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    distance = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    sumradi = r1 + r2
    return distance < sumradi

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 == None:
        return l1
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1, y1, r1, x2, y2, r2):
    if r1 + r2 >= ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    dist = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    if dist - r1 - r2 < 0:
        return True
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    dist = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    inside = r1 > dist + r2 or r2 > dist + r1
    return abs(r1 - r2) <= dist <= abs(r1 + r2) and inside != True

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    dist = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    internal = r1 + r2
    external = abs(r1 - r2)
    return internal == dist or external == dist

Test if two circles overlap.


def append2list(l1, l2=None):
    if l2 is None:
        l2 = []
    else:
        for i in l1:
            l2.append(i)
        return l2


def append2list(l1, l2=None):
    if l2 is None:
        return l1
    else:
        for i in l1:
            l2.append(i)
        return l2


def append2list(l1, l2=None):
    if l2 == None:
        l2 = []
    for i in l1:
        l2.append(i)
    return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    dist = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    internal = r1 + r2
    external = r1 - r2
    return internal == dist or external == dist

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    dist = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
    radii = r1 + r2
    return radii > dist

Test if two circles overlap.


Test if two circles overlap.


def distance(x1, y1, x2, y2):
    disx = (x2 - x1) ** 2
    disy = (y2 - y1) ** 2
    dist = disx + disy
    return math.sqrt(dist)

def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    if distance(x1, y1, x2, y2) < r1 + r2:
        return True
    else:
        return False

Test if two circles overlap.


def overlap(x1=0, y1=0, r1=0, x2=0, y2=0, r2=0):
    A = True
    if x1 == x2 and y1 == y2 and r1 == r2:
        return A
    distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    if abs(distance) <= r1:
        return A
    if abs(distance) <= r2:
        return A
    else:
        return False

Test if two circles overlap.


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    return l2


def append2list(l1, l2=[]):
    for i in l1:
        l2.append(i)
    if len(l2) < 2:
        return l2
    else:
        l2.remove(l2[0])
        l2.remove(l2[0])
        return l2


def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
    rad = (r1 + r2) ** 2
    xs = (x1 - x2) ** 2
    ys = (y1 - y2) ** 2
    both_x_y = xs + ys
    if rad > both_x_y:
        return True
    else:
        return False

Test if two circles overlap.


def search(str, sub):
    i = 0
    while i < len(str):
        if sub == str[i]:
            return i
        i = i + 1
    return -1

assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True

Iteratively search for a letter in a string


def merge_lists(l1, l2):
    l3 = []
    i = 0
    while i < len(l1):
        l3.append(l1[i])
        i += 2
    i = 0
    while i < len(l2):
        l3.append(l2[i])
        i += 2
    return l3


def weird_case(some_str):
    new_str = ''
    i = 0
    lc = 0
    while i < len(some_str):
        if some_str[i].isalpha():
            if lc % 2 == 0:
                new_str += some_str[i].upper()
            else:
                new_str += some_str[i].lower()
            lc += 1
        else:
            new_str += some_str[i]
        i = i + 1
    return new_str


def remove_zeros(list):
    while 0 in list:
        list.remove(0)


def index(str, letter):
    i = 0
    while i < len(str):
        if letter == str[i]:
            return i
        i = i + 1
    return -1

Iteratively search for the position of letter in str, return -1 if it is not there.


def fibonacci(n):
    if n == 0 or n == 1:
        return 1
    else:
        fibN_2 = 1
        fibN_1 = 1
        i = 2
        while i <= n:
            fibN = fibN_2 + fibN_1
            fibN_2 = fibN_1
            fibN_1 = fibN
            i = i + 1
        return fibN

Iteratively compute the value of the fibonacci series at position n.


def search(str, letter):
    i = 0
    while i < len(str):
        if letter == str[i]:
            return True
        i = i + 1
    return False