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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with values.


Swap keys with values.


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

Swap keys with unique values.


Swap keys with unique 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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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}

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with unique values.


Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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)

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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]))

Swap keys with values.


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)

Swap keys with values.


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)

Swap keys with values.


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)

Swap keys with values.


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

Swap keys with values.


Swap keys with unique values.


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)

Swap keys with unique values.


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]}

Swap keys with unique values.


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]}

Swap keys with unique values.


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]}

Swap keys with unique values.


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

Swap keys with values.


Swap keys with values.


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

Swap keys with unique values.


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}

Swap keys with unique values.


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)

Swap keys with unique values.


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

Swap keys with values.


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())}

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with 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

Swap keys with unique values.


Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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}

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with unique values.


Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with 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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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])))

Swap keys with values.


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)

Swap keys with values.


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()))

Swap keys with values.


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()))

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


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)])

Swap keys with values.


Swap keys with values.


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])])

Swap keys with values.


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]))

Swap keys with values.


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])])

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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)

Swap keys with values.


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)

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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]))

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with unique values.


Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique 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

Swap keys with unique 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

Swap keys with unique values.


Swap keys with unique values.


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

Swap keys with values.


Swap keys with values.


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}

Swap keys with unique values.


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}

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with unique values.


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

Swap keys with values.


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

Swap keys with values.


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}

Swap keys with unique values.


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}

Swap keys with unique values.


Swap keys with unique values.


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

Swap keys with values.


Swap keys with values.


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

Append l1 to 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=[]):
    return l2 + l1


def append2list(l1, l2=[]):
    if l2 is 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(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=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=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, 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 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(l1)
    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):
    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 search(list, num):
    i = 0
    while i < len(list):
        if list[i] == num:
            return i
        i = i + 1
    return -1


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

assert remove_zeros([])==None and remove_zeros([])==None and remove_zeros([1, 2, 3, 4, -12, -2])==None and remove_zeros([1, 2, 3, 4, -12, -2])==None and remove_zeros([0, 0, 0, 0, 0])==None and remove_zeros([0, 0, 0, 0, 0])==None and remove_zeros([1, 0, 3, 2, 1, 9, 0, 0, 0])==None and remove_zeros([1, 0, 3, 2, 1, 9, 0, 0, 0])==None

Remove zeros from list.


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

Obtain every second element of l1 and l2.


Remove zeros from list.


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 remove_zeros(list):
    while 0 in list:
        list.remove(0)

Remove zeros from list.


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 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


Remove zeros from list.


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=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.


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


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='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.


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.


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 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 search(str, sub):
    i = 0
    while i < len(str):
        if sub == str[i]:
            return i
        i = i + 1
    return -1

assert search('','0')==-1 and search('0','0')==0 and search('ERFE0Rfsef','0')==4 and search('ERFERfsef0','0')==9 and search('','a')==-1 and search('cbzeycuzbvyzuvb','a')==-1 and search('cbsducsvdbcyts','c')==0 and search('dbzeducvbzy','y')==10 and search('xqvsgxcutvy','u')==7

Return whether a letter is part of a string


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

Remove zeros from list.


def fibonacci(n):
    if n == 0:
        return 1
    elif 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

assert fibonacci(0)==1 and fibonacci(1)==1 and fibonacci(2)==2 and fibonacci(10)==89 and fibonacci(23)==46368

Return the value of the fibonacci series at position n.


Remove zeros from list.


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


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

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


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

Returns the position of letter in str, -1 if it is not there.


def index(str, letter, pos):
    if pos == len(str):
        return -1
    elif str[pos] == letter:
        return pos
    else:
        return index(str, letter, pos + 1)

Return the position of letter in str, -1 if it is not there.


def fibonacci(n):
    if n == 0 or n == 1:
        return 1
    else:
        return fibonacci(n - 1) + fibonacci(n - 2)

assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657


def search(str, letter):
    if str == '':
        return False
    elif str[0] == letter:
        return True
    else:
        return search(str[1:], letter)


def fibonacci(n):
    if n == 0:
        return 0
    if n == 1:
        return 1
    else:
        fibN_2 = 0
        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


def fibonacci(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fibonacci(n - 1) + fibonacci(n - 2)


def index(steve, letter):
    return steve.find(letter)


def fibonacci(n):
    inc1 = 1
    inc2 = 0
    inc3 = ''
    l1 = [0]
    for fib in range(0, n + 1):
        inc3 = inc2
        inc2 = inc1
        inc1 = inc3 + inc2
        l1.append(inc3)
    return l1[n]


def search(steve, letter):
    if letter in steve:
        return True
    else:
        return False


def fibonacci(n):
    inc1 = 1
    inc2 = 0
    inc3 = ''
    l1 = []
    for fib in range(0, n + 1):
        inc3 = inc2
        inc2 = inc1
        inc1 = inc3 + inc2
        l1.append(inc3)
    return l1[n]


def search(str, letter):
    for item in str:
        if item == letter:
            return True
    return False


def search(str, letter):
    if letter in str:
        return True
    else:
        return False


def index(str, letter):
    i = 0
    while i < len(str) and str[i] != letter:
        i += 1
    if letter in str:
        print(i)
    else:
        print('-1')


def search(str, letter):
    if letter in str:
        print(True)
    else:
        print(False)


def search(string, letter):
    i = 0
    if letter in string:
        return True
    else:
        return False


def search(str, letter):
    if letter in str:
        print(True)
    else:
        print(False)
    return str, letter


def index(str, letter):
    i = 0
    while i < len(str) and str[i] != letter:
        i += 1
    if letter in str:
        print(i)
    else:
        print('-1')
    return str, letter


def index(str, letter):
    i = 0
    while i < len(str) and str[i] != letter:
        i += 1
    if letter in str:
        print(i)
    else:
        print('-1')
    return


def search(str, letter):
    if letter in str:
        print(True)
    else:
        print(False)
    return


def search(string, letter):
    if letter in string:
        return True
    else:
        return False


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


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


def search(str, letter):
    for item in str:
        if item == letter:
            return True
        else:
            return False


def search(string, letter):
    i = 0
    test = 1
    while i < len(string):
        if letter == string[i]:
            return true
            test = 2
        i = i + 1
    if test == 1:
        return False


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


def search(str, letter):
    for item in str:
        if item == letter:
            return False
        else:
            return True


def search(str, letter):
    for item in str:
        if item == letter:
            return False
        return True


def search(str, letter):
    for item in str:
        if item == letter:
            return True
        return False


def search(str, letter):
    for item in str:
        if item == letter:
            return True
    return False


def search(str, letter):
    if letter in str:
        print('True')
    else:
        print('False')


def index(str, letter):
    i = 0
    if letter in str:
        letter = letter[0]


def search(string, letter):
    if letter in string:
        print('True')
    else:
        print('False')


def index(str, letter):
    for item in str:
        if item == letter:
            return item
    return '-1'


def countdown(num):
    while num >= 1:
        print(num)
        num = num - 1
        time.sleep(0.1)

def search(str, letter):
    if letter in str:
        print('True')
    else:
        print('False')

def index(str, letter):
    i = 0
    if letter in str:
        letter = letter[0]


def search(string, letter):
    if letter in string:
        print('True')
    else:
        print('False')
    return string


def search(string, letter):
    if letter in string:
        print('True')
    else:
        print('False')
    return 1


def search(string, letter):
    if letter in string:
        print('True')
    else:
        print('False')
    return letter


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


def search(string, letter):
    if letter in string:
        return 'True'
    else:
        return 'False'


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


def search(str, letter):
    list(map(split, str))
    if letter in str:
        return True
    else:
        return False


def search(str, letter):
    if letter in str:
        return True
    else:
        return False