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
|
---|---|---|---|---|---|---|---|---|
15,029 | def swap_keys_values(d):
new_dict = {}
for k in d:
new_dict[d[k]] = k
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 | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
38,789 | def swap_unique_keys_values(a):
lis = []
val = list(a.values())
for no in val:
print(val[0])
if val.count(no) > 1:
lis.append(no)
dir = {}
for i in a:
if a[i] not in lis:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
35,572 | def swap_keys_values(d):
d1 = {v: k for k, v in list(d.items()).sorted()}
print(list(d1.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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
17,211 | def swap_keys_values(d):
d1 = {v: k for k, v in list(d.sorted().items())}
print(list(d1.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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
2,191 | def swap_keys_values(d):
d1 = {v: k for k, v in list(d.items())}
print(list(d1.items()).sorted()) | 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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
17,713 | def swap_keys_values(d):
d1 = {v: k for k, v in list(d.items())}
for c in d1:
print(c) | 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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
26,123 | def swap_keys_values(d):
d1 = {v: k for k, v in list(d.items())}
for c in d1:
print(c) | 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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
31,249 | def swap_keys_values(d):
d1 = {v: k for k, v in list(d.items())}
print(list(d1.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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
27,871 | def swap_keys_values(d):
d1 = {v: k for k, v in list(d.items())}
return d1 | swap_keys_values | swap_keys_values | Swap the keys of a dictionary with its values. | assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'} | true | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
15,088 | def swap_keys_values(d):
d1 = {v: k for k, v in list(d.items())}
return d1 | swap_keys_values | swap_keys_values | Swap the keys of a dictionary with its values. | assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'} | true | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
38,651 | def swap_keys_values(d):
new_dict = dict((v, k) for k, v in list(d.items()))
return new_dict | swap_keys_values | swap_keys_values | Swap the keys of a dictionary with its values. | assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'} | true | a58f503b-2a5d-430c-aea3-11134a0daeb8 | 2,016 |
5,555 | def swap_keys_values(d):
new_dict = dict((v, k) for k, v in list(d.items()))
return new_dict | swap_keys_values | swap_keys_values | Swap the keys of a dictionary with its values. | assert swap_keys_values({})=={} and swap_keys_values({'1': 'a'})=={'a': '1'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'a': '3', 'b': '2'} | true | a58f503b-2a5d-430c-aea3-11134a0daeb8 | 2,016 |
22,872 | def swap_unique_keys_values(d):
new_dict = {}
a = []
for v in list(d.values()):
a.append(v)
for k in d:
if a.count(d[k]) == 1:
new_dict[d[k]] = k
return new_dict | swap_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 | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
25,135 | def swap_unique_keys_values(d):
new_dict = {}
a = []
for v in list(d.values()):
a.append(v)
for k in d:
if a.count(d[k]) == 1:
new_dict[d[k]] = k
return new_dict | swap_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 | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
1,377 | def swap_unique_keys_values():
d1 = {v: k for k, v in list(d.items()) if d.count(v) == 1}
return d1 | swap_unique_keys_values | swap_unique_keys_values | Swap the keys of a dictionary with its unique values. | assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'} | false | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
37,912 | def swap_unique_keys_values():
d1 = {v: k for k, v in list(d.items()) if d.count(d[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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
38,639 | def swap_unique_keys_values(d):
new_dict = {}
for k in d:
v = d.get(k)
if v in new_dict:
del new_dict[v]
else:
new_dict[v] = k
return new_dict | swap_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 | a58f503b-2a5d-430c-aea3-11134a0daeb8 | 2,016 |
15,929 | def swap_unique_keys_values(d):
new_dict = {}
for k in d:
v = d.get(k)
if v in new_dict:
del new_dict[v]
else:
new_dict[v] = k
return new_dict | swap_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 | a58f503b-2a5d-430c-aea3-11134a0daeb8 | 2,016 |
5,813 | def swap_unique_keys_values():
d1 = {v: k for k, v in list(d.items()) if len(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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
14,872 | def swap_unique_keys_values():
d1 = {v: k for k, v in list(d.items()) if len(v) == 1}
return d1 | swap_unique_keys_values | swap_unique_keys_values | Swap the keys of a dictionary with its unique values. | assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'} | false | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
28,302 | def swap_unique_keys_values(d):
d1 = {v: k for k, v in list(d.items()) if d.count(d[v]) == 1}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
13,376 | def swap_unique_keys_values(d):
d1 = {v: k for k, v in list(d.items()) if len(v) > 1}
return d1 | swap_unique_keys_values | swap_unique_keys_values | Swap the keys of a dictionary with its unique values. | assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'} | false | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
29,920 | def swap_unique_keys_values(d):
d1 = {v: k for k, v in list(d.items()) if len(d[v]) > 1}
return d1 | swap_unique_keys_values | swap_unique_keys_values | Swap the keys of a dictionary with its unique values. | assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'} | false | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
11,914 | def swap_unique_keys_values(d):
d1 = {v: k for k, v in list(d.items()) if list(d.items()).count(v) == 1}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
19,156 | def swap_unique_keys_values(d):
d1 = {v: k for k, v in list(d.items()) if d.count(v) == 1}
return d1 | swap_unique_keys_values | swap_unique_keys_values | Swap the keys of a dictionary with its unique values. | assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'} | false | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
25,155 | def swap_unique_keys_values(d):
d1 = {v: k for k, v in list(d.items()) if d.count(d[v]) == 1}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
23,517 | def swap_unique_keys_values(d):
d1 = {v: k for k, v in list(d.items())}
print(d1)
return d1 | swap_unique_keys_values | swap_unique_keys_values | Swap the keys of a dictionary with its unique values. | assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'} | false | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
17,874 | def swap_unique_keys_values(a):
lis = []
for no in a:
lis.append(no)
dir = {}
for i in a:
if no.count(lis) > 1:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
41,929 | def swap_unique_keys_values(a):
lis = []
for no in a:
lis.append(no)
dir = {}
for i in a:
if lis.count(no) > 1:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
32,772 | def swap_unique_keys_values(a):
lis = []
for no in a:
lis.append(no)
dir = {}
for i in a:
if lis.count(no) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
40,074 | def swap_unique_keys_values(a):
lis = []
for no in a:
lis.append(no)
dir = {}
print(lis)
for i in a:
if lis.count(no) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
32,134 | def swap_unique_keys_values(a):
lis = []
for no in a:
lis.append(a[no])
dir = {}
for i in a:
if lis.count(no) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
34,938 | def swap_unique_keys_values(a):
lis = []
for no in a:
lis.append(a[no])
dir = {}
print(lis)
for i in a:
if lis.count(no) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
20,258 | def swap_unique_keys_values(a):
lis = []
for no in a:
lis.append(a[no])
dir = {}
print(lis)
for i in a:
if no.count(lis) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
39,349 | def swap_unique_keys_values(a):
lis = []
for no in a:
lis.append(a[no])
dir = {}
for i in a:
if a[no].count(lis) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
16,624 | def swap_keys_values(d):
d2 = dict((v, k) for k, v in list(d.items()))
return d2 | 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 | 2b99bb5a-b2e4-4bc1-b1ae-ecb59c74bd22 | 2,016 |
11,240 | def swap_keys_values(d):
d2 = dict((v, k) for k, v in list(d.items()))
return d2 | 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 | 2b99bb5a-b2e4-4bc1-b1ae-ecb59c74bd22 | 2,016 |
16,177 | def swap_unique_keys_values(a):
lis = []
for no in a:
lis.append(str(a[no]))
dir = {}
for i in a:
if str(a[no]).count(lis) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
17,106 | def swap_unique_keys_values(a):
lis = []
for no in a:
lis.append(str(a[no]))
dir = {}
for i in a:
if lis.count(str(a[no])) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
8,049 | def swap_unique_keys_values(d):
d1 = {v: k for k, v in list(d.items())}
for c in d1:
print(c) | 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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
29,206 | def swap_unique_keys_values(d):
d1 = list(d.items())
print(d1) | swap_unique_keys_values | swap_unique_keys_values | Swap the keys of a dictionary with its unique values. | assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'} | false | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
32,220 | def swap_unique_keys_values(d):
dict = {}
for k in d:
v = d.get(k)
if v in dict:
del dict[v]
else:
dict[v] = k
return dict | swap_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 | 2b99bb5a-b2e4-4bc1-b1ae-ecb59c74bd22 | 2,016 |
5,783 | def swap_unique_keys_values(d):
dict = {}
for k in d:
v = d.get(k)
if v in dict:
del dict[v]
else:
dict[v] = k
return dict | swap_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 | 2b99bb5a-b2e4-4bc1-b1ae-ecb59c74bd22 | 2,016 |
25,089 | def swap_unique_keys_values(d):
d = list(d.items())
for c in d:
print(c) | 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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
18,511 | def swap_unique_keys_values(a):
lis = ''
for no in a:
lis += a[no]
dir = {}
for i in a:
if lis.count(str(a[no])) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
31,009 | def swap_unique_keys_values(a):
lis = ''
for no in a:
lis += a[no]
dir = {}
for i in a:
if str(a[no]).count(lis) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
39,221 | def swap_unique_keys_values(a):
lis = ''
for no in a:
lis += str(a[no])
dir = {}
for i in a:
if str(a[no]).count(lis) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
2,240 | def swap_unique_keys_values(a):
lis = ''
for no in a:
lis += str(a[no])
dir = {}
print(lis)
for i in a:
if str(a[no]).count(lis) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
39,268 | def swap_unique_keys_values(a):
lis = ''
for no in a:
lis += str(a[no])
dir = {}
print(lis)
for i in a:
print(str(a[no]).count(lis))
if str(a[no]).count(lis) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
26,592 | def swap_unique_keys_values(d):
d = list(d.items())
l = [(v, k) for k, v in d if d.count(c[1]) == 1]
print(l) | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
42,153 | def swap_unique_keys_values(a):
lis = ''
for no in a:
lis += str(a[no])
dir = {}
print(lis)
for i in a:
print(lis.count(str(a[no])))
if str(a[no]).count(lis) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
5,983 | def swap_unique_keys_values(d):
d = list(d.items())
l = [v for k, v in d]
print(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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
11,323 | def swap_unique_keys_values(a):
lis = ''
for no in a:
lis += str(a[no])
dir = {}
print(lis)
for i in a:
print(str(a[no]).count(lis))
if str(a[no]).count(lis) < 2:
dir[a[i]] = i
return dir | swap_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 | a48376ed-7138-4481-a4da-74490838ea3e | 2,016 |
17,509 | def swap_unique_keys_values(d):
c = {}
e = []
r = {}
seen = {}
for value in list(d.values()):
if value not in c:
c[value] = 1
else:
c[value] += 1
for keys, values in list(c.items()):
if values == 2:
e.append(keys)
del values
for key in e:
for value in list(d.items()):
if key not in value:
r[value[0]] = value[1]
my_dict = r
new_dict = {v: k for k, v in list(my_dict.items())}
return new_dict | swap_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 | f463a026-5eb4-4a39-a858-3a798215a4ee | 2,016 |
34,097 | def swap_unique_keys_values(d):
c = {}
e = []
r = {}
seen = {}
for value in list(d.values()):
if value not in c:
c[value] = 1
else:
c[value] += 1
for keys, values in list(c.items()):
if values == 2:
e.append(keys)
del values
for key in e:
for value in list(d.items()):
if key not in value:
r[value[0]] = value[1]
my_dict = r
new_dict = {v: k for k, v in list(my_dict.items())}
return new_dict | swap_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 | f463a026-5eb4-4a39-a858-3a798215a4ee | 2,016 |
35,400 | def swap_unique_keys_values(d):
c = {}
e = []
r = {}
seen = {}
for value in list(d.values()):
if value not in c:
c[value] = 1
else:
c[value] += 1
for keys, values in list(c.items()):
if values == 2:
e.append(keys)
del values
for key in e:
for value in list(d.items()):
if key not in value:
r[value[0]] = value[1]
my_dict = r
new_dict = {v: k for k, v in list(my_dict.items())}
return new_dict | swap_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 | f463a026-5eb4-4a39-a858-3a798215a4ee | 2,016 |
32,126 | def swap_unique_keys_values(d):
d = list(d.items())
l = [v for k, v in d]
z = []
for c in l:
if l.count(c) == 1:
z.append(c)
d1 = {v: k for k, v in list(d.items()) if v in z}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
9,178 | def swap_unique_keys_values(d):
l = [v for k, v in d]
z = []
for c in l:
if l.count(c) == 1:
z.append(c)
d1 = {v: k for k, v in list(d.items()) if v in z}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
8,895 | def swap_unique_keys_values(d):
l = [(k, v) for k, v in d]
z = []
for c in l:
if l.count(c[1]) == 1:
z.append(c[1])
d1 = {v: k for k, v in list(d.items()) if v in z}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
38,701 | def swap_unique_keys_values(d):
z = []
for c in list(d.items()):
if l.count(c[1]) == 1:
z.append(c[1])
d1 = {v: k for k, v in list(d.items()) if v in z}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
4,730 | def swap_unique_keys_values(d):
z = []
for c in list(d.items()):
if list(d.items()).count(c[1]) == 1:
z.append(c[1])
d1 = {v: k for k, v in list(d.items()) if v in z}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
15,618 | def swap_unique_keys_values(d):
z = []
for c in list(d.items()):
print(c)
d1 = {v: k for k, v in list(d.items()) if v in z}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
12,777 | def swap_unique_keys_values(d):
z = []
for c in list(d.items()):
print(c[1])
d1 = {v: k for k, v in list(d.items()) if v in z}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
41,611 | def swap_unique_keys_values(d):
z = []
for c in list(d.items()):
z.append(c[1])
d1 = {v: k for k, v in list(d.items()) if v in z}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
29,782 | def swap_unique_keys_values(d):
d1 = {}
d2 = {}
unique = []
for k in list(d.keys()):
if k in d:
d1[k] += 1
else:
d1[k] = 1
for k, v in list(d.items()):
if d1[k] == 1:
d2[v] = k
else:
continue
return d2 | swap_unique_keys_values | swap_unique_keys_values | Swap the keys of a dictionary with its unique values. | assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'} | false | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
13,972 | def swap_unique_keys_values(d):
d1 = {}
d2 = {}
unique = []
for k in list(d.keys()):
if k in d1:
d1[k] += 1
else:
d1[k] = 1
for k, v in list(d.items()):
if d1[k] == 1:
d2[v] = k
else:
continue
return d2 | swap_unique_keys_values | swap_unique_keys_values | Swap the keys of a dictionary with its unique values. | assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'c', '4': 'd'})=={'a': '1', 'b': '2', 'c': '3', 'd': '4'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': 'a'})=={'b': '2'} | false | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
27,490 | def swap_unique_keys_values(d):
z = []
l = []
for c in list(d.items()):
l.append(c[1])
for c in l:
if l.count(c) == 1:
z.append(c)
d1 = {v: k for k, v in list(d.items()) if v in z}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
24,511 | def swap_unique_keys_values(d):
z = []
l = []
for c in list(d.items()):
l.append(c[1])
for c in l:
if l.count(c) == 1:
z.append(c)
d1 = {v: k for k, v in list(d.items()) if v in z}
return d1 | swap_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 | 29883390-7aa0-4484-9f1e-6fd0c1c8c420 | 2,016 |
12,557 | def swap_unique_keys_values(d):
new_dict = {}
for k in d:
v = d.get(k)
if v in new_dict:
del new_dict[v]
else:
new_dict[v] = k
return new_dict | swap_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 | fa2c47e6-9c25-4040-9985-e5ab62711be6 | 2,016 |
35,468 | def swap_unique_keys_values(d):
new_dict = {}
for k in d:
v = d.get(k)
if v in new_dict:
del new_dict[v]
else:
new_dict[v] = k
return new_dict | swap_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 | fa2c47e6-9c25-4040-9985-e5ab62711be6 | 2,016 |
2,979 | def swap_unique_keys_values(d):
d1 = {}
d2 = {}
unique = []
for v in list(d.values()):
if v in d1:
d1[v] += 1
else:
d1[v] = 1
for k, v in list(d.items()):
if d1[v] == 1:
d2[v] = k
else:
continue
return d2 | swap_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 | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
42,233 | def swap_unique_keys_values(d):
d1 = {}
d2 = {}
unique = []
for v in list(d.values()):
if v in d1:
d1[v] += 1
else:
d1[v] = 1
for k, v in list(d.items()):
if d1[v] == 1:
d2[v] = k
else:
continue
return d2 | swap_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 | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
12,744 | def swap_keys_values(d):
dic = {}
for key, value in list(d.items()):
dic[value] = key
return dic | 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 | fc73b043-0c96-4ce3-8b8f-2c4c98785aa6 | 2,016 |
19,626 | def swap_keys_values(d):
dic = {}
for key, value in list(d.items()):
dic[value] = key
return dic | 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 | fc73b043-0c96-4ce3-8b8f-2c4c98785aa6 | 2,016 |
34,420 | def swap_unique_keys_values(d):
tempd = {}
alltupps = [(v, k) for k, v in d]
return alltupps | 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 | 9550e418-a019-49c2-a2e9-8322a300fb6f | 2,016 |
37,484 | def swap_unique_keys_values(d):
global skip
check = []
for x in list(d.keys()):
if d[x] not in check:
check.append(d[x])
else:
skip.append(d[x])
return skip | swap_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 | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
32,046 | def swap_unique_keys_values(d):
tempd = {}
alltupps = [(v, k) for k, v in list(d.items())]
return alltupps | 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 | 9550e418-a019-49c2-a2e9-8322a300fb6f | 2,016 |
36,906 | def swap_unique_keys_values(in_dict):
out_dict = {}
blacklist = set()
for k, v in list(in_dict.items()):
if v in out_dict:
blacklist.update([v])
del out_dict[v]
elif v not in blacklist:
out_dict[v] = k
return out_dict | swap_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 | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
38,991 | def swap_unique_keys_values(in_dict):
out_dict = {}
blacklist = set()
for k, v in list(in_dict.items()):
if v in out_dict:
blacklist.update([v])
del out_dict[v]
elif v not in blacklist:
out_dict[v] = k
return out_dict | swap_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 | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
40,623 | def swap_keys_values(in_dict):
out_dict = {}
for k, v in list(in_dict.items()):
out_dict[v] = k
return out_dict | swap_keys_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 | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
6,000 | def swap_keys_values(in_dict):
out_dict = {}
for k, v in list(in_dict.items()):
out_dict[v] = k
return out_dict | swap_keys_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 | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
32,055 | def swap_unique_keys_values(d):
tempd = {}
alltupps = []
for k, v in list(d.items()):
alltupps.append(v, k)
return alltupps | 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 | 9550e418-a019-49c2-a2e9-8322a300fb6f | 2,016 |
18,749 | def swap_unique_keys_values(d):
tempd = {}
alltupps = []
for k, v in list(d.items()):
alltupps.append((v, k))
return alltupps | 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 | 9550e418-a019-49c2-a2e9-8322a300fb6f | 2,016 |
15,588 | def swap_unique_keys_values(d):
dic = {}
for key, value in list(d.items()):
if value not in dic:
dic[value] = key
else:
del dic[value]
return dic | swap_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 | fc73b043-0c96-4ce3-8b8f-2c4c98785aa6 | 2,016 |
20,267 | def swap_unique_keys_values(d):
dic = {}
for key, value in list(d.items()):
if value not in dic:
dic[value] = key
else:
del dic[value]
return dic | swap_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 | fc73b043-0c96-4ce3-8b8f-2c4c98785aa6 | 2,016 |
5,958 | def swap_keys_values(swap_me):
print(list({swap_me[key]: key for key in list(swap_me.keys())}.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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
23,944 | def swap_keys_values(swap_me):
print(list({swap_me[key]: key for key in list(swap_me.keys())}.items())
.sort(key=lambda x: x[0])) | swap_keys_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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
20,502 | def swap_keys_values(swap_me):
o = list({swap_me[key]: key for key in list(swap_me.keys())}.items())
o.sort(key=lambda x: x[0])
print(o) | swap_keys_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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
32,480 | def swap_keys_values(swap_me):
o = {swap_me[key]: key for key in list(swap_me.keys())}
o = list(o.items())
o = list(o)
o.sort(key=lambda x: x[0])
print(o) | swap_keys_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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
32,872 | def swap_keys_values(swap_me):
if swap_me is not None:
o = {swap_me[key]: key for key in list(swap_me.keys())}
o = list(o.items())
o = list(o)
o.sort(key=lambda x: x[0])
print(o) | swap_keys_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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
11,933 | def swap_keys_values(in_dict):
out_dict = {}
for k, v in list(in_dict.items()):
out_dict[v] = k
return out_dict | swap_keys_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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
36,921 | def swap_keys_values(in_dict):
out_dict = {}
for k, v in list(in_dict.items()):
out_dict[v] = k
return out_dict | swap_keys_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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
7,234 | def swap_keys_values(swap_me):
if swap_me is not None:
return {swap_me[key]: key for key in list(swap_me.keys())} | swap_keys_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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
1,594 | def swap_keys_values(swap_me):
if swap_me is not None:
return {swap_me[key]: key for key in list(swap_me.keys())} | swap_keys_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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
38,004 | def swap_unique_keys_values(in_dict):
out_dict = {}
blacklist = set()
for k, v in list(in_dict.items()):
if v in out_dict:
blacklist.update([v])
del out_dict[v]
elif v not in blacklist:
out_dict[v] = k
return out_dict | swap_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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
13,161 | def swap_unique_keys_values(in_dict):
out_dict = {}
blacklist = set()
for k, v in list(in_dict.items()):
if v in out_dict:
blacklist.update([v])
del out_dict[v]
elif v not in blacklist:
out_dict[v] = k
return out_dict | swap_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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
35,150 | def seen(k, v):
global skip
if v in skip:
return k, v
else:
return v, k
def swap_unique_keys_values(d):
global skip
check = []
for x in list(d.keys()):
if d[x] not in check:
check.append(d[x])
else:
skip.append(d[x])
d = [seen(k, v) for k, v in list(d.items())]
print(d) | swap_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 | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
8,245 | def swap_unique_keys_values(swap_me):
if swap_me is not None:
d = {swap_me[key]: key for key in list(set(swap_me.keys)) if
swap_me[key]} | swap_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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
35 | def swap_unique_keys_values(swap_me):
if swap_me is not None:
d = {swap_me[key]: key for key in list(set(swap_me.keys())) if
swap_me[key]} | swap_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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
41,412 | def swap_unique_keys_values(swap_me):
if swap_me is not None:
return {swap_me[key]: key for key in list(set(swap_me.keys())) if
swap_me[key]} | swap_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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.