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
|
---|---|---|---|---|---|---|---|---|
1,171 | 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 | 6a42703e-da42-4824-8b83-b6f291ad71be | 2,016 |
35,025 | 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 | 6a42703e-da42-4824-8b83-b6f291ad71be | 2,016 |
1,864 | def swap_unique_keys_values(d):
store = {}
di = d
for key in d[0:-1]:
for k in di[1:]:
if d[key] == di[k]:
continue
else:
store[key] = d[key]
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
14,086 | def swap_unique_keys_values(d):
store = {}
di = d
for key in d[0:len(d) - 1]:
for k in di[1:]:
if d[key] == di[k]:
continue
else:
store[key] = d[key]
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
21,186 | def swap_unique_keys_values(d):
store = {}
di = d
for key in d:
for k in di:
if d[key] == di[k]:
continue
else:
store[key] = d[key]
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
38,879 | def swap_unique_keys_values(d):
return {v: k for k, v in list(d.items()) if d.values.count(k) > 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 | 5cf0f5b5-a91e-4c33-8ac1-92aa868cd3b0 | 2,016 |
37,022 | def swap_unique_keys_values(d):
return {v: k for k, v in list(d.items()) if d.values.count(k) > 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 | 5cf0f5b5-a91e-4c33-8ac1-92aa868cd3b0 | 2,016 |
39,869 | def swap_unique_keys_values(d):
store = {}
di = d
for key in d:
for k in di:
if d[key] == di[k]:
0
else:
store[key] = d[key]
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
8,329 | 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 | 573bd795-e55d-4f35-83cb-b4c309fb0d57 | 2,016 |
12,147 | 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 | 573bd795-e55d-4f35-83cb-b4c309fb0d57 | 2,016 |
35,395 | def swap_unique_keys_values(d):
store = {}
di = d
for key in d:
for k in di:
if di[k] == d[key]:
0
else:
store[key] = d[key]
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
38,431 | def swap_unique_keys_values(d):
store = {}
di = d
for key in d:
for k in di:
if di[k] == d[key]:
0
else:
store[k] = d[k]
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
8,284 | def swap_unique_keys_values(d):
return {v: k for k, v in list(d.items()) if list(d.values()).count(k) > 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 | 5cf0f5b5-a91e-4c33-8ac1-92aa868cd3b0 | 2,016 |
33,923 | def swap_unique_keys_values(d):
store = {}
di = d
for key in d:
for k in di:
if di[k] == d[key]:
break
else:
store[key] = d[key]
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
41,936 | 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 | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
7,304 | def swap_unique_keys_values(d):
return {v: k for k, v in list(d.items()) if list(d.values()).count(k) > 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 | 5cf0f5b5-a91e-4c33-8ac1-92aa868cd3b0 | 2,016 |
6,803 | def swap_unique_keys_values(d):
new_d = {}
for key, value in list(d.items()):
if value not in list(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 |
34,347 | def swap_unique_keys_values(d):
return {v: k for k, v in list(d.items()) if list(d.values()).count(k) == 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 | 5cf0f5b5-a91e-4c33-8ac1-92aa868cd3b0 | 2,016 |
25,566 | def swap_keys_values(d):
return {v: k for k, v in list(my_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 | ccb230ef-8610-4130-8882-d0643817d9b4 | 2,016 |
17,696 | 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 | ccb230ef-8610-4130-8882-d0643817d9b4 | 2,016 |
10,434 | 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 | ccb230ef-8610-4130-8882-d0643817d9b4 | 2,016 |
19,078 | 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 | 5cf0f5b5-a91e-4c33-8ac1-92aa868cd3b0 | 2,016 |
33,221 | 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 | 5cf0f5b5-a91e-4c33-8ac1-92aa868cd3b0 | 2,016 |
35,064 | 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 | 5cf0f5b5-a91e-4c33-8ac1-92aa868cd3b0 | 2,016 |
41,127 | 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 | 66e06699-d10a-47f1-a343-55edd72e95d2 | 2,016 |
6,378 | def swap_keys_values(dictionary):
dictionary = {v: k for k, v in list(dictionary.items())}
return dictionary | 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 | 0473ca8a-3862-4046-a34c-16eb754fdfff | 2,016 |
40,492 | def swap_keys_values(dictionary):
dictionary = {v: k for k, v in list(dictionary.items())}
return dictionary | 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 | 0473ca8a-3862-4046-a34c-16eb754fdfff | 2,016 |
19,021 | def swap_unique_keys_values(d):
store = {}
for k, v in list(d.items()):
if d.count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
15,352 | def swap_keys_values(d):
{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'} | false | 98d44d17-92f8-4274-915e-b88bdd9dca26 | 2,016 |
9,680 | def swap_unique_keys_values(d):
store = {}
for k, v in list(d.items()):
print(d.count(v))
if d.count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
1,881 | def swap_unique_keys_values(d):
return {v: k for k, v in list(d.items()) if list(list(d.values()).count
(k) >= 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 | 6a42703e-da42-4824-8b83-b6f291ad71be | 2,016 |
6,271 | 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 | 98d44d17-92f8-4274-915e-b88bdd9dca26 | 2,016 |
20,345 | 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 |
23,373 | 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 |
16,267 | 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 |
32,922 | def swap_unique_keys_values(d):
store = {}
print(list(d.values()))
for k, v in list(d.items()):
print(d.count(v))
if d.count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
40,162 | def swap_unique_keys_values(d):
store = {}
for k, v in list(d.items()):
if d.count(d.values) == 1:
store[k] = v
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
6,554 | def swap_unique_keys_values(d):
return {v: k for k, v in list(d.items()) if list(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 | 6a42703e-da42-4824-8b83-b6f291ad71be | 2,016 |
8,270 | def swap_unique_keys_values(d):
new_d = {}
for key, value in list(d.items()):
if value not in list(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 |
7,105 | def swap_unique_keys_values(d):
new_d = {}
for key, value in list(d.items()):
if value not in list(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 |
33,520 | def swap_unique_keys_values(d):
new_d = {}
for key, value in list(d.items()):
if value not in list(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 |
92 | def swap_unique_keys_values(d):
store = {}
for k, v in list(d.items()):
if d.values.count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
2,098 | 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 | 573bd795-e55d-4f35-83cb-b4c309fb0d57 | 2,016 |
25,676 | 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 | 573bd795-e55d-4f35-83cb-b4c309fb0d57 | 2,016 |
40,364 | 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 | 573bd795-e55d-4f35-83cb-b4c309fb0d57 | 2,016 |
39,090 | def swap_unique_keys_values(d):
store = {}
for k, v in list(d.items()):
if list(d.values()).count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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'} | true | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
10,866 | 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 | 98d44d17-92f8-4274-915e-b88bdd9dca26 | 2,016 |
28,481 | 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 | 98d44d17-92f8-4274-915e-b88bdd9dca26 | 2,016 |
26,170 | 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 | 98d44d17-92f8-4274-915e-b88bdd9dca26 | 2,016 |
14,350 | def swap_unique_keys_values(d):
store = {}
va = list(d.values())
print(va)
for k, v in list(d.items()):
if va.count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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'} | true | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
35,644 | 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 | 6a42703e-da42-4824-8b83-b6f291ad71be | 2,016 |
24,238 | 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 | 6a42703e-da42-4824-8b83-b6f291ad71be | 2,016 |
38,315 | 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 | 6a42703e-da42-4824-8b83-b6f291ad71be | 2,016 |
33,848 | def swap_unique_keys_values(d):
store = {}
val = []
va = list(d.values())
for i in va:
val = va.append(i)
for k, v in list(d.items()):
if va.count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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 | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
28,525 | def swap_unique_keys_values(d):
store = {}
val = []
va = list(d.values())
for i in va:
val.append(i)
for k, v in list(d.items()):
if va.count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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'} | true | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
21,708 | def swap_unique_keys_values(d):
store = {}
val = []
va = list(d.values())
for i in va:
val.append(i)
print(val)
for k, v in list(d.items()):
if va.count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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'} | true | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
26,580 | def swap_unique_keys_values(d):
store = {}
val = []
va = list(d.values())
for i in va:
val.append(i)
print(val)
for k, v in list(d.items()):
if val.count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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'} | true | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
39,435 | def swap_unique_keys_values(d):
store = {}
val = []
va = list(d.values())
for i in va:
val.append(i)
for k, v in list(d.items()):
if val.count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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'} | true | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
16,687 | def swap_unique_keys_values(d):
store = {}
val = []
va = list(d.values())
for i in va:
val.append(i)
for k, v in list(d.items()):
if val.count(v) == 1:
store[k] = v
return {v: k for k, v in list(store.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'} | true | 051d024e-69b1-48d1-ba77-a6f2d97a48bc | 2,016 |
40,824 | def swap_unique_keys_values(d):
for pairs in zip(list(d.values()), list(d.items())):
print(pairs) | 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 | 0473ca8a-3862-4046-a34c-16eb754fdfff | 2,016 |
20,490 | def unique(data):
previous = []
new = []
for integer in data:
if integer not in new and integer not in previous:
new.append(integer)
elif integer not in new and integer in previous:
continue
elif integer in new and integer not in previous:
previous.append(integer)
new.remove(integer)
return new
def swap_unique_keys_values(d):
values = [n for n in list(d.values())]
special = unique(values)
return {v: k for k, v in list(d.items()) if v in special} | 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 | 0473ca8a-3862-4046-a34c-16eb754fdfff | 2,016 |
6,988 | def unique(data):
previous = []
new = []
for integer in data:
if integer not in new and integer not in previous:
new.append(integer)
elif integer not in new and integer in previous:
continue
elif integer in new and integer not in previous:
previous.append(integer)
new.remove(integer)
return new
def swap_unique_keys_values(d):
values = [n for n in list(d.values())]
special = unique(values)
return {v: k for k, v in list(d.items()) if v in special} | 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 | 0473ca8a-3862-4046-a34c-16eb754fdfff | 2,016 |
474 | def unique(data):
previous = []
new = []
for integer in data:
if integer not in new and integer not in previous:
new.append(integer)
elif integer not in new and integer in previous:
continue
elif integer in new and integer not in previous:
previous.append(integer)
new.remove(integer)
return new
def swap_unique_keys_values(d):
values = [n for n in list(d.values())]
special = unique(values)
return {v: k for k, v in list(d.items()) if v in special} | 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 | 0473ca8a-3862-4046-a34c-16eb754fdfff | 2,016 |
20,124 | def swap_unique_keys_values(d):
new_d = {}
for k, v in list(d.items()):
if not v in new_d:
new_d[v] = k
else:
del new_d[v]
return new_d | 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 | ccb230ef-8610-4130-8882-d0643817d9b4 | 2,016 |
29,278 | def swap_unique_keys_values(d):
new_d = {}
for k, v in list(d.items()):
if not v in new_d:
new_d[v] = k
else:
del new_d[v]
return new_d | 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 | ccb230ef-8610-4130-8882-d0643817d9b4 | 2,016 |
28,476 | def swap_unique_keys_values(d):
new_d = {}
for k, v in list(d.items()):
if not v in new_d:
new_d[v] = k
else:
del new_d[v]
return new_d | 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 | ccb230ef-8610-4130-8882-d0643817d9b4 | 2,016 |
19,895 | def swap_keys_values(k, v):
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'} | false | f1c26f39-fb4c-4010-aaa3-142fb52f57b9 | 2,016 |
31,202 | 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 | f1c26f39-fb4c-4010-aaa3-142fb52f57b9 | 2,016 |
15,048 | 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 | f1c26f39-fb4c-4010-aaa3-142fb52f57b9 | 2,016 |
16,835 | 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 | f1c26f39-fb4c-4010-aaa3-142fb52f57b9 | 2,016 |
100 | 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 | fa2c47e6-9c25-4040-9985-e5ab62711be6 | 2,016 |
39,523 | 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 | fa2c47e6-9c25-4040-9985-e5ab62711be6 | 2,016 |
10,249 | 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 | fa2c47e6-9c25-4040-9985-e5ab62711be6 | 2,016 |
16,122 | def swap_keys_values(d):
my_dict = d
new_dict = {v: k for k, v in list(my_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 | 7a72123c-6850-4e9f-b407-211283f04a4c | 2,016 |
17,815 | def swap_keys_values(d):
my_dict = d
new_dict = {v: k for k, v in list(my_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 | 7a72123c-6850-4e9f-b407-211283f04a4c | 2,016 |
8,364 | def swap_keys_values(d):
my_dict = d
new_dict = {v: k for k, v in list(my_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 | 7a72123c-6850-4e9f-b407-211283f04a4c | 2,016 |
27,368 | def swap_keys_values(dict):
return {v: k for k, v in list(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'} | true | a493c80e-3567-462a-bcbe-7bd974d52d8a | 2,016 |
8,400 | def swap_keys_values(dict):
return {v: k for k, v in list(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'} | true | a493c80e-3567-462a-bcbe-7bd974d52d8a | 2,016 |
20,137 | def swap_unique_keys_values(dict):
return {v: k for k, v in list(dict.items()) if dict.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 | a493c80e-3567-462a-bcbe-7bd974d52d8a | 2,016 |
37,778 | def swap_unique_keys_values(dict):
return {v: k for k, v in list(dict.items()) if list(dict.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 | a493c80e-3567-462a-bcbe-7bd974d52d8a | 2,016 |
31,718 | def swap_unique_keys_values(dict):
return {v: k for k, v in list(dict.items()) if list(dict.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 | a493c80e-3567-462a-bcbe-7bd974d52d8a | 2,016 |
18,378 | def swap_unique_keys_values(dict):
return {v: k for k, v in list(dict.items()) if list(dict.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 | a493c80e-3567-462a-bcbe-7bd974d52d8a | 2,016 |
17,057 | def swap_unique_keys_values(dict):
return {v: k for k, v in list(dict.items()) if list(dict.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 | a493c80e-3567-462a-bcbe-7bd974d52d8a | 2,016 |
16,008 | 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 | 91bbbbbf-cad8-4507-9c4d-c7cfe0ebc210 | 2,016 |
36,856 | 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 | 91bbbbbf-cad8-4507-9c4d-c7cfe0ebc210 | 2,016 |
41,753 | 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 | 91bbbbbf-cad8-4507-9c4d-c7cfe0ebc210 | 2,016 |
26,833 | def swap_unique_keys_values(d):
d2 = {}
values = list(d.values())
for k, v in list(d.items()):
if values.count(v) == 1:
d2[v] = k
print(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 |
7,978 | def swap_unique_keys_values(d):
d2 = {}
values = list(d.values())
d2 = [(v, k) for k, v in list(d.items()) if values.count(v) == 1]
print(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 |
29,182 | def swap_unique_keys_values(d):
d2 = {}
values = list(d.values())
d2 = [(v, k) for k, v in sorted(d.items()) if values.count(v) == 1]
print(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 |
30,386 | def swap_unique_keys_values(d):
d2 = {}
values = list(d.values())
d2 = [(v, k) for k, v in list(sorted(d).items()) if values.count(v) == 1]
print(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 |
30,006 | def swap_unique_keys_values(d):
d2 = {}
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 |
21,750 | def swap_unique_keys_values(d):
d2 = {}
values = list(d.values())
sort = sorted(d.items())
d2 = [(v, k) for k, v in sort if values.count(v) == 1]
print(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 |
17,074 | def swap_unique_keys_values(d):
values = list(d.values())
l = [(k, v) for k, v in list(d.items()) if values.count(v) == 1]
print(sorted(l)) | 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 |
15,103 | def swap_unique_keys_values(d):
values = list(d.values())
l = [(v, k) for k, v in list(d.items()) if values.count(v) == 1]
print(sorted(l)) | 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 |
32,247 | def swap_unique_keys_values(d):
values = list(d.values())
l = [(k, v) for k, v in list(d.items()) if values.count(v) == 1]
print(sorted(l)) | 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 |
27,167 | def swap_unique_keys_values(d):
values = list(d.values())
items = list(d.items())
l = [(v, k) for k, v in items if values.count(v) == 1]
print(sorted(l)) | 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 |
8,905 | def swap_unique_keys_values(d):
print(d)
values = list(d.values())
items = list(d.items())
l = [(v, k) for k, v in items if values.count(v) == 1]
print(sorted(l)) | 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 |
11,006 | def swap_unique_keys_values(d):
values = list(d.values())
items = list(d.items())
l = [(v, k) for k, v in items if values.count(v) == 1]
print(sorted(l)) | 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 |
8,384 | def swap_unique_keys_values(d):
values = list(d.values())
items = list(d.items())
l = [(v, k) for k, v in items if values.count(v) == 1]
return sorted(l) | 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 |
37,086 | def swap_unique_keys_values(d):
values = list(d.values())
items = list(d.items())
l = {v: k for k, v in items if values.count(v) == 1}
return sorted(l) | 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 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.