submission_id
int32
10
42.5k
func_code
stringlengths
22
782
assignment_id
stringlengths
4
23
func_name
stringlengths
4
23
description
stringlengths
26
128
test
stringlengths
45
1.22k
correct
bool
2 classes
user
stringlengths
36
36
academic_year
int32
2.02k
2.02k
10,623
def swap_unique_keys_values(d): new_d = {} keys = list(set(d.keys())) values = list(set(d.values())) i = 0 while i < len(keys): new_d[values[i]] = keys[i] return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
27,773
def swap_unique_keys_values(d): new_d = {} keys = list(set(d.keys())) values = list(set(d.values())) i = 0 while i < len(keys): new_d[values[i]] = keys[i] i = i + 1 return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
5,191
def swap_unique_keys_values(d): new_d = {} keys = list(set(d.keys())) values = list(set(d.values())) print((keys, values))
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
20,446
def swap_unique_keys_values(d): new_d = {} a = list(set(d.values()) & set(d.values())) for k, v in list(d.items()): if v not in a: new_d[v] = k return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
25,599
def swap_unique_keys_values(d): new_d = {} a = list(set(d.values()) & set(d.values())) print(a) for k, v in list(d.items()): if v not in a: new_d[v] = k return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
19,093
def swap_unique_keys_values(d): new_d = {} a = list(d.values()) - list(set(d.values)) print(a) for k, v in list(d.items()): if v not in a: new_d[v] = k return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
13,118
def swap_unique_keys_values(d): new_d = {} a = list(d.values()) - (list(set(d.values())) - list(d.values())) print(a) for k, v in list(d.items()): if v not in a: new_d[v] = k return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
39,564
def swap_unique_keys_values(d): new_d = {} a = set(d.values()) | set(d.values()) print(a)
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
7,509
def swap_unique_keys_values(d): new_d = {} a = set(d.values()) & set(d.values()) print(a)
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
16,406
def swap_unique_keys_values(d): new_d = {} a = list(d.values()) - list(set(d.values())) print(a)
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
16,169
def swap_unique_keys_values(d): new_d = {} a = list(d.values()) - set(d.values()) print(a)
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
5,128
def swap_unique_keys_values(d): return {v: k for k, v in list(d.items()) if list(d.values()).count(v) == 1}
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
19,401
def swap_unique_keys_values(d): return {v: k for k, v in list(d.items()) if [v for v in list(d.values() )].count(v) == 1}
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
41,191
def swap_unique_keys_values(d): return {v: k for k, v in list(d.items()) if [v for v in list(d.values() )].count(v) == 1}
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
1,814
def swap_unique_keys_values(d): return {v: k for k, v in list(d.items()) if [v for v in list(d.values() )].count(v) == 1}
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
9a05c20e-2fde-40c1-948b-649e25b30e6e
2,016
18,847
def swap_keys_values(d_0): d = {} for key in d_0: d[d_0[key]] = key return d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
3328e1f8-ae85-4d26-8d1c-386e7e2467dc
2,016
35,871
def swap_keys_values(d_0): d = {} for key in d_0: d[d_0[key]] = key return d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
3328e1f8-ae85-4d26-8d1c-386e7e2467dc
2,016
26,690
def swap_unique_keys_values(d_0): d = {} for key in d_0: d[d_0[key]] = key return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
3328e1f8-ae85-4d26-8d1c-386e7e2467dc
2,016
4,287
def swap_unique_keys_values(d_0): d = {} for key in d_0: if d_0[key] not in d: d[d_0[key]] = key else: del d[d_0[key]] return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
3328e1f8-ae85-4d26-8d1c-386e7e2467dc
2,016
12,819
def swap_unique_keys_values(d_0): d = {} for key in d_0: if d_0[key] not in d: d[d_0[key]] = key else: del d[d_0[key]] return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
3328e1f8-ae85-4d26-8d1c-386e7e2467dc
2,016
40,338
def swap_unique_keys_values(d_0): d = {} for key in d_0: if d_0[key] not in d: d[d_0[key]] = key else: del d[d_0[key]] return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
3328e1f8-ae85-4d26-8d1c-386e7e2467dc
2,016
34,754
def swap_keys_values(d): {v: k for k, v in d.items} return d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
false
9550e418-a019-49c2-a2e9-8322a300fb6f
2,016
15,653
def swap_keys_values(d): {v: k for k, v in d.items} return d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
false
9550e418-a019-49c2-a2e9-8322a300fb6f
2,016
13,026
def swap_keys_values(d): {v: k for k, v in d.items} return d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
false
9550e418-a019-49c2-a2e9-8322a300fb6f
2,016
3,459
def swap_keys_values(a): new_dict = {v: k for k, v in list(a.items())} return new_dict
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
9e18f731-fa38-496b-927b-db0cd1aa3409
2,016
20,649
def swap_keys_values(a): new_dict = {v: k for k, v in list(a.items())} return new_dict
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
9e18f731-fa38-496b-927b-db0cd1aa3409
2,016
38,273
def swap_keys_values(a): new_dict = {v: k for k, v in list(a.items())} return new_dict
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
9e18f731-fa38-496b-927b-db0cd1aa3409
2,016
32,937
def swap_unique_keys_values(d): keys = [] values = [] dict_keys = [] dict_values = [] dump = [] for k, v in list(d.items()): keys.append(k) values.append(v) for num in values: test = num values = values[1:] if test in values: dump.append(test) elif test not in values and test not in dump: dict_keys.append(test) dict_values.append(keys[0]) keys = keys[1:] print(dict_keys) print(dict_values) d = {} i = 0 while i < len(dict_keys): d[dict_keys[i]] = dict_values[i] i = i + 1 return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
72de96bc-40bc-48ca-b1c3-91150748b31a
2,016
41,774
def swap_unique_keys_values(d): keys = [] values = [] dict_keys = [] dict_values = [] dump = [] for k, v in list(d.items()): keys.append(k) values.append(v) for num in values: test = num values = values[1:] if test in values: dump.append(test) elif test not in values and test not in dump: dict_keys.append(test) dict_values.append(keys[0]) keys = keys[1:] d = {} i = 0 while i < len(dict_keys): d[dict_keys[i]] = dict_values[i] i = i + 1 return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
72de96bc-40bc-48ca-b1c3-91150748b31a
2,016
15,330
def swap_unique_keys_values(d): keys = [] values = [] dict_keys = [] dict_values = [] dump = [] for k, v in list(d.items()): keys.append(k) values.append(v) for num in values: test = num values = values[1:] if test in values: dump.append(test) elif test not in values and test not in dump: dict_keys.append(test) dict_values.append(keys[0]) keys = keys[1:] i = 0 while i < len(dict_keys): d[dict_keys[i]] = dict_values[i] i = i + 1 return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
72de96bc-40bc-48ca-b1c3-91150748b31a
2,016
32,523
def swap_unique_keys_values(d): keys = [] values = [] dict_keys = [] dict_values = [] dump = [] for k, v in list(d.items()): keys.append(k) values.append(v) for num in values: test = num values = values[1:] if test in values: dump.append(test) elif test not in values and test not in dump: dict_keys.append(test) dict_values.append(keys[0]) keys = keys[1:] d = {} i = 0 while i < len(dict_keys): d[dict_keys[i]] = dict_values[i] i = i + 1 return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
72de96bc-40bc-48ca-b1c3-91150748b31a
2,016
1,748
def swap_unique_keys_values(d): keys = [] values = [] dict_keys = [] dict_values = [] dump = [] for k, v in list(d.items()): keys.append(k) values.append(v) for num in values: test = num values = values[1:] if test in values: dump.append(test) elif test not in values and test not in dump: dict_keys.append(test) dict_values.append(keys[0]) keys = keys[1:] d = {} for i in range(0, len(dict_keys)): d[dict_keys[i]] = dict_values[i] return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
72de96bc-40bc-48ca-b1c3-91150748b31a
2,016
20,250
def swap_unique_keys_values(d): keys = [] values = [] dict_keys = [] dict_values = [] dump = [] for k, v in list(d.items()): keys.append(k) values.append(v) for num in values: test = num values = values[1:] if test in values: dump.append(test) elif test not in values and test not in dump: dict_keys.append(test) dict_values.append(keys[0]) keys = keys[1:] d = {} for i in range(0, len(dict_keys)): d[dict_keys[i]] = dict_values[i] return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
72de96bc-40bc-48ca-b1c3-91150748b31a
2,016
2,254
def swap_unique_keys_values(d): keys = [] values = [] dict_keys = [] dict_values = [] dump = [] for k, v in list(d.items()): keys.append(k) values.append(v) for num in values: test = num values = values[1:] if test in values: dump.append(test) elif test not in values and test not in dump: dict_keys.append(test) dict_values.append(keys[0]) keys = keys[1:] d = {} for i in range(0, len(dict_keys)): d[dict_keys[i]] = dict_values[i] return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
72de96bc-40bc-48ca-b1c3-91150748b31a
2,016
11,552
def swap_unique_keys_values(d): new_d = {} t = [] for k, v in list(d.items()): if v not in new_d: new_d[v] = k else: t.append(v) for v in t: del new_d[v] return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
98d44d17-92f8-4274-915e-b88bdd9dca26
2,016
23,690
def swap_unique_keys_values(d): new_d = {} t = [] for k, v in list(d.items()): if v not in new_d: new_d[v] = k else: t.append(v) for v in t: del new_d[v] return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
98d44d17-92f8-4274-915e-b88bdd9dca26
2,016
3,504
def swap_unique_keys_values(d): new_d = {} t = [] for k, v in list(d.items()): if v not in new_d: new_d[v] = k else: t.append(v) for v in t: del new_d[v] return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
98d44d17-92f8-4274-915e-b88bdd9dca26
2,016
21,086
def swap_unique_keys_values(d): return {v: k for k, v in list(d.items())}
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
f1c26f39-fb4c-4010-aaa3-142fb52f57b9
2,016
42,371
def swap_unique_keys_values(d): new_dict = dict([(v, k) for k, v in list(d.items()) if list(d.values()) .count(v) == 1])
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
f1c26f39-fb4c-4010-aaa3-142fb52f57b9
2,016
8,654
def swap_unique_keys_values(d): new_dict = print(sorted(dict([(v, k) for k, v in d.items() if list(d. values()).count(v) == 1])))
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
f1c26f39-fb4c-4010-aaa3-142fb52f57b9
2,016
28,249
def swap_unique_keys_values(d): new_dict = print(sorted(dict([(v, k) for k, v in d.items() if list(d. values()).count(v) == 1])))
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
f1c26f39-fb4c-4010-aaa3-142fb52f57b9
2,016
9,094
def swap_unique_keys_values(d): new_dict = print(sorted(dict([(v, k) for k, v in d.items() if list(d. values()).count(v) == 1])))
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
f1c26f39-fb4c-4010-aaa3-142fb52f57b9
2,016
15,836
def swap_unique_keys_values(d): return {v: k for k, v in list(d.items()) if v not in list(d.keys())}
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
36,795
def swap_keys_values(d): return {value: key for key, value in list(d.items())}
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
a6392e0c-005c-4131-a7bb-80cf6af877de
2,016
41,724
def swap_keys_values(d): return {value: key for key, value in list(d.items())}
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
a6392e0c-005c-4131-a7bb-80cf6af877de
2,016
29,475
def swap_unique_keys_values(d): new_dict = {value: key for key, value in list(d.items()) if value not in new_dict}
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
a6392e0c-005c-4131-a7bb-80cf6af877de
2,016
31,856
def swap_unique_keys_values(d): new_dict = {value: key for key, value in list(d.items()) if value not in new_dict} return new_dict
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
a6392e0c-005c-4131-a7bb-80cf6af877de
2,016
35,658
def swap_unique_keys_values(d): new_dict = {} for key, value in list(d.items()): if value not in new_dict: new_dict[value] = key return new_dict
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
a6392e0c-005c-4131-a7bb-80cf6af877de
2,016
29,755
def swap_unique_keys_values(d): new_dict = {} for key, value in list(d.items()): if value not in new_dict: new_dict[value] = key else: del new_dict[value] return new_dict
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
a6392e0c-005c-4131-a7bb-80cf6af877de
2,016
18,497
def swap_unique_keys_values(d): new_dict = {} for key, value in list(d.items()): if value not in new_dict: new_dict[value] = key else: del new_dict[value] return new_dict
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
a6392e0c-005c-4131-a7bb-80cf6af877de
2,016
14,398
def swap_unique_keys_values(d): return {v: k for k, v in list(d.items()) if list(d.values()).count(v) == 1}
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
24,699
def swap_unique_keys_values(d): return {v: k for k, v in list(d.items()) if list(d.values()).count(v) == 1}
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
7,618
def swap_unique_keys_values(d): return {v: k for k, v in list(d.items()) if list(d.values()).count(v) == 1}
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
31,352
def swap_keys_values(my_dict): d = {v: k for k, v in list(d.items())} return d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
false
b0c92748-3b02-4340-a9d8-2ebe9a693531
2,016
3,984
def swap_keys_values(my_dict): d = {v: k for k, v in list(d.items())} return d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
false
b0c92748-3b02-4340-a9d8-2ebe9a693531
2,016
35,917
def swap_keys_values(my_dict): d = {v: k for k, v in list(d.items())} return d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
false
b0c92748-3b02-4340-a9d8-2ebe9a693531
2,016
5,657
def swap_unique_keys_values(d): items = set(d.itmes()) for w in items: if items.count(w) > 1: d.pop(d[w]) d = {v: k for k, v in list(d.items())} return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
b3fb7be5-b8f9-4b08-be4d-66eb3fcb7782
2,016
21,397
def swap_unique_keys_values(d): items = set(d.items()) for w in items: if items.count(w) > 1: d.pop(d[w]) d = {v: k for k, v in list(d.items())} return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
b3fb7be5-b8f9-4b08-be4d-66eb3fcb7782
2,016
2,177
def swap_keys_values(d): new_d = dict(list(zip(list(d.values()), list(d.keys())))) return new_d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
bd03ecd6-cea3-4854-803a-b14d429489a7
2,016
10,709
def swap_keys_values(d): new_d = dict(list(zip(list(d.values()), list(d.keys())))) return new_d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
bd03ecd6-cea3-4854-803a-b14d429489a7
2,016
14,484
def swap_keys_values(d): new_d = dict(list(zip(list(d.values()), list(d.keys())))) return new_d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
bd03ecd6-cea3-4854-803a-b14d429489a7
2,016
17,439
def swap_unique_keys_values(d): items = set(d.items()) for w in items: if items.count(w) > 1: d.pop(d[w]) print(items) d = {v: k for k, v in list(d.items())} return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
b3fb7be5-b8f9-4b08-be4d-66eb3fcb7782
2,016
34,423
def swap_unique_keys_values(d): items = set(d.items()) print(items) d = {v: k for k, v in list(d.items())} return d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
b3fb7be5-b8f9-4b08-be4d-66eb3fcb7782
2,016
19,349
def swap_unique_keys_values(d): items = set(d.items()) print(items)
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
b3fb7be5-b8f9-4b08-be4d-66eb3fcb7782
2,016
30,555
def swap_unique_keys_values(d): items = set(d.items()) print(items)
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
b3fb7be5-b8f9-4b08-be4d-66eb3fcb7782
2,016
33,173
def swap_unique_keys_values(d): items = set(d.items()) print(items)
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
b3fb7be5-b8f9-4b08-be4d-66eb3fcb7782
2,016
6,112
def swap_keys_values(my_dict): d = {v: k for k, v in list(d.items())} return d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
false
b0c92748-3b02-4340-a9d8-2ebe9a693531
2,016
18,156
def swap_keys_values(my_dict): d = {v: k for k, v in list(d.items())} return d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
false
b0c92748-3b02-4340-a9d8-2ebe9a693531
2,016
6,344
def swap_keys_values(my_dict): d = {v: k for k, v in list(d.items())} return d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
false
b0c92748-3b02-4340-a9d8-2ebe9a693531
2,016
30,148
def swap_unique_keys_values(a): new_dict = {v: k for k, v in list(a.items())} l = [] for i in a: l.append(a[i]) for i in l: if l.count(i) > 1: del new_dict[i] break return new_dict return new_dict
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
9e18f731-fa38-496b-927b-db0cd1aa3409
2,016
18,406
def swap_unique_keys_values(a): new_dict = {v: k for k, v in list(a.items())} l = [] for i in a: l.append(a[i]) for i in l: if l.count(i) > 1: del new_dict[i] break return new_dict return new_dict
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
9e18f731-fa38-496b-927b-db0cd1aa3409
2,016
17,836
def swap_unique_keys_values(a): new_dict = {v: k for k, v in list(a.items())} l = [] for i in a: l.append(a[i]) for i in l: if l.count(i) > 1: del new_dict[i] break return new_dict return new_dict
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
9e18f731-fa38-496b-927b-db0cd1aa3409
2,016
22,561
def swap_unique_keys_values(a): new_dict = {v: k for k, v in list(a.items())} l = [] for i in a: l.append(a[i]) for i in l: if l.count(i) > 1: del new_dict[i] break return new_dict return new_dict
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
9e18f731-fa38-496b-927b-db0cd1aa3409
2,016
10,459
def swap_keys_values(d): new_dict = dict([(v, k) for k, v in list(d.items())]) return new_dict
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
4e44ac28-c84a-43ee-9b95-c4270d7bb030
2,016
28,220
def swap_keys_values(d): new_dict = dict([(v, k) for k, v in list(d.items())]) return new_dict
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
4e44ac28-c84a-43ee-9b95-c4270d7bb030
2,016
27,267
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_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
4e44ac28-c84a-43ee-9b95-c4270d7bb030
2,016
6,805
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_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
4e44ac28-c84a-43ee-9b95-c4270d7bb030
2,016
16,312
def swap_keys_values(d): new_d = {} for k in d: new_d[d[k]] = k return new_d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
ba8a7560-aac9-45ef-b6fd-730b60e73e8c
2,016
25,595
def swap_keys_values(d): new_d = {} for k in d: new_d[d[k]] = k return new_d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
ba8a7560-aac9-45ef-b6fd-730b60e73e8c
2,016
23,987
def swap_keys_values(d): new_d = {} for k in d: new_d[d[k]] = k return new_d
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
ba8a7560-aac9-45ef-b6fd-730b60e73e8c
2,016
41,649
def swap_keys_values(d): new_dict = dict([(v, k) for k, v in list(d.items())]) return new_dict
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
652b3384-e559-46c5-81db-1bf2117db63b
2,016
10,714
def swap_keys_values(d): new_dict = dict([(v, k) for k, v in list(d.items())]) return new_dict
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
652b3384-e559-46c5-81db-1bf2117db63b
2,016
8,351
def swap_unique_keys_values(d): new_dict = dict([(v, k) for k, v in list(d.items()) if list(d.values()) .count(v) == 1]) return new_dict
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
652b3384-e559-46c5-81db-1bf2117db63b
2,016
6,985
def swap_unique_keys_values(d): new_dict = dict([(v, k) for k, v in list(d.items()) if list(d.values()) .count(v) == 1]) return new_dict
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
652b3384-e559-46c5-81db-1bf2117db63b
2,016
4,465
def swap_unique_keys_values(d): new_d = {} for k in d: if d[k] not in new_d: new_d[d[k]] = k return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
ba8a7560-aac9-45ef-b6fd-730b60e73e8c
2,016
36,894
def swap_unique_keys_values(d): new_d = {} for k in d: if d[k] not in new_d: new_d[d[k]] = k return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
ba8a7560-aac9-45ef-b6fd-730b60e73e8c
2,016
31,754
def swap_keys_values(d): return {v: k for k, v in list(d.items())}
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
336d0cd0-002e-4296-ba45-582077aac4a4
2,016
27,507
def swap_keys_values(d): return {v: k for k, v in list(d.items())}
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
336d0cd0-002e-4296-ba45-582077aac4a4
2,016
30,160
def swap_keys_values(d): return {v: k for k, v in list(d.items())}
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
336d0cd0-002e-4296-ba45-582077aac4a4
2,016
16,540
def swap_keys_values(d): new_dict = {v: k for k, v in list(d.items())} print(sorted(new_dict.items()))
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
false
46954879-c4e4-4ce6-87d4-00184c62b522
2,016
38,689
def swap_keys_values(d): new_dict = {v: k for k, v in list(d.items())} print(sorted(new_dict.items()))
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
false
46954879-c4e4-4ce6-87d4-00184c62b522
2,016
29,085
def swap_keys_values(d): return {v: k for k, v in list(d.items())}
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
3e9f1e04-e9fd-4164-8fa5-c7feb1dcc1f5
2,016
14,734
def swap_keys_values(d): return {v: k for k, v in list(d.items())}
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
3e9f1e04-e9fd-4164-8fa5-c7feb1dcc1f5
2,016
22,460
def swap_keys_values(d): d1 = {} for k, v in list(d.items()): d1[v] = k return d1
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
e5db5e57-0261-4967-963a-42d1a98c03de
2,016
4,822
def swap_keys_values(d): d1 = {} for k, v in list(d.items()): d1[v] = k return d1
swap_keys_values
swap_keys_values
Swap the keys of a dictionary with its values.
assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'}
true
e5db5e57-0261-4967-963a-42d1a98c03de
2,016
4,533
def swap_unique_keys_values(d): new_d = {} values = list(d.values()) keys = list(d.keys()) i = 0 for i in range(0, len(values)): if values.count(values[i]) < 2: new_d[values[i]] = keys[i] return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
ba8a7560-aac9-45ef-b6fd-730b60e73e8c
2,016
26,302
def swap_unique_keys_values(d): new_d = {} values = list(d.values()) keys = list(d.keys()) i = 0 for i in range(0, len(values)): if values.count(values[i]) < 2: new_d[values[i]] = keys[i] return new_d
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
true
ba8a7560-aac9-45ef-b6fd-730b60e73e8c
2,016
8,868
def swap_unique_keys_values(d): d1 = {} num = [] let = [] for k, v in list(d.items()): if v not in num and k not in let: d1[v] = k num.append(v) let.append(k) return d1
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
e5db5e57-0261-4967-963a-42d1a98c03de
2,016
2,662
def swap_unique_keys_values(d): d1 = {} num = [] let = [] print(d) for k, v in list(d.items()): if v not in num and k not in let: d1[v] = k num.append(v) let.append(k) return d1
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
e5db5e57-0261-4967-963a-42d1a98c03de
2,016
14,202
def swap_unique_keys_values(d): d1 = {} num = [] let = [] print(d) for k, v in list(d.items()): if v not in num and k not in let: d1[v] = k num.append(v) let.append(k) return d1
swap_unique_keys_values
swap_unique_keys_values
Swap the keys of a dictionary with its unique values.
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'}
false
e5db5e57-0261-4967-963a-42d1a98c03de
2,016