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
|
---|---|---|---|---|---|---|---|---|
41,827 | def swap_unique_keys_values(d):
print(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 | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
38,319 | def swap_unique_keys_values(d):
print(d)
print(list(d.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 | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
17,325 | def swap_unique_keys_values(d):
print(d)
values = list(d.values())
print(sorted(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 | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
20,370 | def swap_unique_keys_values(d):
print(d)
values = list(d.values())
print(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 | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
17,425 | def swap_unique_keys_values(d):
values = list(d.values())
items = [(y, x) for x, y in list(d.items())]
d2 = {v: k for k, v in sorted(items)}
return d2 | 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 | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
35,355 | def swap_unique_keys_values(d):
values = list(d.values())
items = [(y, x) for x, y in list(d.items())]
d2 = {k: v for k, v in sorted(items)}
return d2 | 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 | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
28,331 | 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_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 | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
42,168 | 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_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 | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
40,603 | 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_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 | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
18,597 | def swap_keys_values(d):
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'} | true | b3fb7be5-b8f9-4b08-be4d-66eb3fcb7782 | 2,016 |
3,986 | def swap_keys_values(d):
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'} | true | b3fb7be5-b8f9-4b08-be4d-66eb3fcb7782 | 2,016 |
22,806 | def swap_unique_keys_values(d):
for w in list(d.keys()):
if list(d.keys()).count(w) > 1:
d.popitem(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 |
22,648 | def swap_unique_keys_values(d):
for w in list(d.items()):
if list(d.items()).count(w) > 1:
d.popitem(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 |
19,112 | def swap_unique_keys_values(d):
for w in list(d.items()):
if list(d.items()).count(w) > 1:
m = w
d.popitem(d[w])
d.popitem(d[m])
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 |
22,906 | def swap_unique_keys_values(d):
for w in list(d.items()):
if list(d.items()).count(w) > 1:
m = w
d.popitem(d[w])
d.popitem(d[m])
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,523 | def swap_unique_keys_values(d):
for w in list(d.items()):
m = ''
if list(d.items()).count(w) > 1:
m = w
d.popitem(d[w])
d.popitem(d[m])
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 |
623 | def swap_unique_keys_values(d):
print(lies(list(d.items())))
for w in list(d.items()):
if list(d.items()).count(w) > 1:
d.popitem(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 |
34,793 | def swap_unique_keys_values(d):
print(list(d.items()))
for w in list(d.items()):
if list(d.items()).count(w) > 1:
d.popitem(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 |
31,535 | def swap_unique_keys_values(d):
print(list(d.keys()))
for w in list(d.items()):
if list(d.items()).count(w) > 1:
d.popitem(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 |
39,450 | def swap_unique_keys_values(d):
print(list(d.keys()))
for w in list(d.items()):
if list(d.items()).count(w) > 1:
d.popitem(d[w])
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 |
5,699 | def swap_unique_keys_values(d):
print(list(d.items()))
for w in list(d.items()):
if list(d.items()).count(w) > 1:
d.popitem(d[w])
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 |
31,813 | def swap_unique_keys_values(d):
print(list(d.items()))
for w in list(d.items()):
if list(d.items()).count(w) > 1:
d.popitem(d[w]) | 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 |
14,534 | def swap_unique_keys_values(d):
print(list(d.items()))
for w in list(d.items()):
if list(d.items()).count(w) > 1:
for s in list(d.items()):
if d[s] == d[w]:
d.popitem(d[s])
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 |
8,752 | def swap_unique_keys_values(d):
for w in list(d.items()):
if list(d.items()).count(w) > 1:
for s in list(d.items()):
if d[s] == d[w]:
d.popitem(d[s])
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 |
7,688 | def swap_unique_keys_values(d):
for w in list(d.items()):
if list(d.items()).count(w) > 1:
for s in list(d.items()):
if d[s] == d[w]:
d.popitem(d[s])
d.popitem(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 |
13,758 | def swap_unique_keys_values(d):
for w in list(d.items()):
if list(d.items()).count(w) > 1:
d.popitem(d[w])
for s in list(d.items()):
if d[s] == w:
d.popitem(d[s])
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 |
37,771 | def swap_unique_keys_values(d):
print(list(d.items()))
for w in list(d.items()):
if list(d.items()).count(w) > 1:
d.popitem(d[w])
for s in list(d.items()):
if d[s] == w:
d.popitem(d[s])
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 |
11,677 | def swap_unique_keys_values(d):
items = list(d.items())
for w in items:
if items.count(w) > 1:
d.popitem(d[w])
for s in items:
if d[s] == w:
d.popitem(d[s])
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 |
6,017 | def swap_unique_keys_values(d):
items = list(d.items())
for w in items:
if items.count(w) > 1:
d.popitem(d[w])
for s in items:
if s == w:
d.popitem(d[s])
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 |
4,580 | def swap_unique_keys_values(d):
items = list(d.items())
for w in items:
if items.count(w) > 1:
d.popitem(d[w])
for s in items:
if s == w:
d.popitem(d[s])
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 |
38,344 | def swap_unique_keys_values(d):
items = list(d.items())
for w in items:
if items.count(w) > 1:
d.popitem(d[w])
for s in items:
if s == w:
d.popitem(d[s])
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 |
18,656 | def swap_keys_values(dict):
new_dict = {v: k for k, v in list(dict.items())}
print(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'} | false | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
28,762 | def swap_keys_values(dict):
new_dict = {v: k for k, v in list(dict.items())}
print(list(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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
13,309 | def swap_keys_values(dict):
new_dict = {v: k for k, v in list(dict.items())}
print([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'} | false | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
2,754 | def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
print([new_dict])
for k in new_dict:
l.append('({} : {})'.format(k, new_dict[k]))
print(l) | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
1,002 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append('({} : {})'.format(k, new_dict[k]))
print(sorted(l, key=my_function)) | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
13,654 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append('({} : {})'.format(k, new_dict[k]))
print('[' + ', '.join(sorted(l, key=my_function)) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
10,524 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append('({} : {})'.format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-2))) + ']')
print(type(l[1])) | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
8,418 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append('({} : {})'.format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-2))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
41,094 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append('({}, : {})'.format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-2))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
40,713 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append('({}, {})'.format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-2))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
34,949 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append('({}, {})'.format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-2))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
18,971 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append('({}, {:2s})'.format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-2))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
9,675 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append('({}, {:>2s})'.format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-2))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
32,640 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append('({}, {:>2s})'.format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-2))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
5,011 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append("({}, '{:>2s}')".format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-2))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
28,278 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append("({}, '{}')".format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-2))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
1,339 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append("({}, '{}')".format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-3))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
30,369 | def my_function(a):
return a[1]
def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
def my_function(a):
return a[1]
for k in new_dict:
l.append("({}, '{}')".format(int(k), new_dict[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-3))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
16,438 | def swap_keys_values(dict):
l = []
new_dict = {v: k for k, v in list(dict.items())}
new_dict1 = new_dict.copy()
for k in new_dict1:
l.append("({}, '{}')".format(int(k), new_dict1[k]))
print('[' + ', '.join(sorted(l, key=itemgetter(-3))) + ']') | 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
8,377 | def swap_keys_values(a):
l = []
new_dict = {v: k for k, v in list(a.items())}
return 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
16,994 | def swap_keys_values(a):
new_dict = {v: k for k, v in list(a.items())}
return 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 | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
22,286 | def swap_keys_values(a):
new_dict = {v: k for k, v in list(a.items())}
pprint(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'} | false | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
14,165 | def swap_keys_values(a):
new_dict = {v: k for k, v in list(a.items())}
pprint(sorted(new_dict.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'} | false | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
36,616 | def swap_keys_values(a):
new_dict = {v: k for k, v in list(a.items())}
pprint(sorted(new_dict.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'} | false | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
38,570 | def swap_keys_values(a):
new_dict = {v: k for k, v in list(a.items())}
print(sorted(new_dict.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 |
6,832 | def swap_keys_values(a):
new_dict = {v: k for k, v in list(a.items())}
print(sorted(new_dict.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 |
6,536 | def swap_keys_values(a):
new_dict = {v: k for k, v in list(a.items())}
return sorted(new_dict.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'} | false | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
5,464 | def swap_keys_values(a):
new_dict = {v: k for k, v in list(a.items())}
print(type(sorted(new_dict.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 |
11,981 | def swap_keys_values(a):
new_dict = {v: k for k, v in list(a.items())}
pprint(sorted(new_dict.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'} | false | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
19,805 | def swap_keys_values(a):
new_dict = {v: k for k, v in list(a.items())}
pprint(sorted(new_dict.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'} | false | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
18,178 | def swap_keys_values(a):
new_dict = {v: k for k, v in list(a.items())}
pprint(sorted(new_dict.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'} | false | 9e18f731-fa38-496b-927b-db0cd1aa3409 | 2,016 |
18,854 | def swap_keys_values(d):
new_d = {}
for key in d:
new_d[d[key]] = key
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 | 3bcffc16-908f-42c5-9ac3-f685ae6eca33 | 2,016 |
30,482 | def swap_keys_values(d):
new_d = {}
for key in d:
new_d[d[key]] = key
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 | 3bcffc16-908f-42c5-9ac3-f685ae6eca33 | 2,016 |
26,062 | def swap_unique_keys_values(d):
new_d = {}
for key in d:
if list(d.values()).count(d[key]) == 1:
new_d[d[key]] = key
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 | 3bcffc16-908f-42c5-9ac3-f685ae6eca33 | 2,016 |
5,048 | def swap_unique_keys_values(d):
new_d = {}
a = []
for key in d:
for value in list(d.values()):
a.append(value)
if a.count(d[key]) == 1:
new_d[d[key]] = key
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 | 3bcffc16-908f-42c5-9ac3-f685ae6eca33 | 2,016 |
3,431 | def swap_unique_keys_values(d):
new_d = {}
a = []
for value in list(d.values()):
a.append(value)
for key in d:
if a.count(d[key]) == 1:
new_d[d[key]] = key
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 | 3bcffc16-908f-42c5-9ac3-f685ae6eca33 | 2,016 |
36,126 | def swap_unique_keys_values(d):
new_d = {}
a = []
for value in list(d.values()):
a.append(value)
for key in d:
if a.count(d[key]) == 1:
new_d[d[key]] = key
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 | 3bcffc16-908f-42c5-9ac3-f685ae6eca33 | 2,016 |
42,331 | def swap_unique_keys_values(d):
new_d = {}
a = []
for value in list(d.values()):
a.append(value)
for key in d:
if a.count(d[key]) == 1:
new_d[d[key]] = key
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 | 3bcffc16-908f-42c5-9ac3-f685ae6eca33 | 2,016 |
23,826 | def swap_keys_values(d):
new_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 | b13f3dba-a06b-4528-a4d8-c2ee1a5bb34d | 2,016 |
25,614 | def swap_keys_values(d):
new_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 | b13f3dba-a06b-4528-a4d8-c2ee1a5bb34d | 2,016 |
3,387 | def swap_keys_values(d):
new_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 | b13f3dba-a06b-4528-a4d8-c2ee1a5bb34d | 2,016 |
24,662 | def swap_unique_keys_values(d):
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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
17,554 | 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
16,089 | def swap_unique_keys_values(d):
return {v: k for k, v in list(d.items()) if v not in list(d.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 |
38,461 | 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
40,877 | def swap_unique_keys_values(d):
return {v: k for k, v in list(d.items()) if 'a' not 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
20,489 | def swap_unique_keys_values(d):
return {v: k for k, v in list(d.items()) if 'a' not 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
21,121 | def swap_unique_keys_values(d):
return {v: k for k, v in list(d.items()) if 'a' not 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
29,130 | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
9,038 | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
11,283 | def swap_unique_keys_values(d):
l = []
m = []
for v in list(d.values()):
if v in l:
m.append(v)
else:
l.append(v)
return {v: k for k, v in list(d.items()) if v not in m} | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
10,543 | def swap_unique_keys_values(d):
l = []
m = []
for v in list(d.values()):
if v in l:
m.append(v)
else:
l.append(v)
return {v: k for k, v in list(d.items()) if v not in m} | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
16,760 | def swap_unique_keys_values(d):
l = []
m = []
for v in list(d.values()):
if v in l:
m.append(v)
else:
l.append(v)
return {v: k for k, v in list(d.items()) if v not in m} | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
31,716 | def swap_unique_keys_values(d):
l = []
m = []
for v in list(d.values()):
if v in l:
m.append(v)
else:
l.append(v)
return {v: k for k, v in list(d.items()) if v not in m} | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
18,312 | def swap_keys_values(d):
d = {v: k for k, v in list(d.items())}
return d
if __name__ == '__main__':
main() | 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 | 72de96bc-40bc-48ca-b1c3-91150748b31a | 2,016 |
23,531 | def swap_keys_values(d):
d = {v: k for k, v in list(d.items())}
return d
if __name__ == '__main__':
main() | 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 | 72de96bc-40bc-48ca-b1c3-91150748b31a | 2,016 |
32,715 | def swap_keys_values(d):
d = {v: k for k, v in list(d.items())}
return d
if __name__ == '__main__':
main() | 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 | 72de96bc-40bc-48ca-b1c3-91150748b31a | 2,016 |
14,972 | def swap_keys_values(s):
for k, v in list(my_dict.items()):
del my_dict[k]
my_dict[v] = k
print(my_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'} | false | c0bd18cc-b8fa-4b4a-87c2-5e1043d7ff6c | 2,016 |
27,255 | 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 |
14,682 | def swap_keys_values(d):
new_dict = {}
for pair in list(d.items()):
new_dict[pair[1]] = pair[0]
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 | e84cb3e0-5b98-4543-816e-a3570ba72e05 | 2,016 |
28,814 | def swap_keys_values(d):
new_dict = {}
for pair in list(d.items()):
new_dict[pair[1]] = pair[0]
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 | e84cb3e0-5b98-4543-816e-a3570ba72e05 | 2,016 |
39,024 | def swap_keys_values(d):
new_dict = {}
for pair in list(d.items()):
new_dict[pair[1]] = pair[0]
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 | e84cb3e0-5b98-4543-816e-a3570ba72e05 | 2,016 |
30,056 | def swap_unique_keys_values(d):
new_dict = {}
for pair in list(d.items()):
if pair[1] not in new_dict:
new_dict[pair[1]] = pair[0]
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 | e84cb3e0-5b98-4543-816e-a3570ba72e05 | 2,016 |
19,804 | def swap_unique_keys_values(d):
new_dict = {}
for pair in list(d.items()):
if pair[1] not in new_dict:
new_dict[pair[1]] = pair[0]
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 | e84cb3e0-5b98-4543-816e-a3570ba72e05 | 2,016 |
25,983 | def swap_unique_keys_values(d):
new_dict = {}
for pair in list(d.items()):
if pair[1] not in new_dict:
new_dict[pair[1]] = pair[0]
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 | e84cb3e0-5b98-4543-816e-a3570ba72e05 | 2,016 |
17,591 | def swap_unique_keys_values(d):
new_dict = {}
for pair in list(d.items()):
if pair[1] not in new_dict:
new_dict[pair[1]] = pair[0]
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 | e84cb3e0-5b98-4543-816e-a3570ba72e05 | 2,016 |
4,239 | def swap_unique_keys_values(d):
new_dict = {}
for pair in list(d.items()):
if pair[1] not in new_dict:
new_dict[pair[1]] = pair[0]
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 | e84cb3e0-5b98-4543-816e-a3570ba72e05 | 2,016 |
1,642 | def swap_unique_keys_values(d):
new_d = {}
for key, value in list(d.items()):
if value not in list(new_d.values()):
new_d[key] = value
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,226 | def swap_unique_keys_values(d):
new_d = {}
for key, value in list(d.items()):
if value not in list(new_d.values()):
new_d[value] = key
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 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.