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
|
---|---|---|---|---|---|---|---|---|
18,982 |
def maximum(list):
if len(list) == 1:
return list[0]
else:
if list[-1] < list[0]:
list.pop(-1)
else:
list.pop(0)
return maximum(list)
|
maximum
|
maximum
|
Return the maximum element in a list of numbers.
|
assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9
| true |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
899 |
def count_letters(string):
if not string:
return 0
else:
return 1 + count_letters(string.replace(string[0], ''))
|
count_letters
|
count_letters
|
Return the number of lettres in a string.
|
assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13
| false |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
5,658 |
def count_letters(string):
if not string:
return 0
else:
return 1 + count(string.replace(string[0], ''))
|
count_letters
|
count_letters
|
Return the number of lettres in a string.
|
assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13
| false |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
11,941 |
def count_letters(string):
if not string:
return 0
else:
return 1 + count_letters(string.replace(string[0], ''))
|
count_letters
|
count_letters
|
Return the number of lettres in a string.
|
assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13
| false |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
17,297 |
def count_letters(string):
if not string:
return 0
else:
return 1 + count_letters(string.replace(string[0], '', 1))
|
count_letters
|
count_letters
|
Return the number of lettres in a string.
|
assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13
| true |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
10,149 |
def count_letters(string):
if not string:
return 0
else:
return 1 + count_letters(string.replace(string[0], '', 1))
|
count_letters
|
count_letters
|
Return the number of lettres in a string.
|
assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13
| true |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
877 |
def reverse_list(list):
if not list:
return list
else:
return list[-1] + reverse_list(list)
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| false |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
26,877 |
def reverse_list(listt):
if not listt:
return listt
else:
return list(listt[-1]) + reverse_list(listt[:-1])
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| false |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
17,328 |
def reverse_list(listt):
if not listt:
return listt
else:
return [listt[-1]] + reverse_list(listt[:-1])
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| true |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
4,690 |
def reverse_list(listt):
if not listt:
return listt
else:
return [listt[-1]] + reverse_list(listt[:-1])
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| true |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
36,753 |
def reverse_list(listt):
if not listt:
return listt
else:
return [listt[-1]] + reverse_list(listt[:-1])
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| true |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
17,465 |
def selection_sort(a):
for i in range(len(a)):
least = i
for k in range(i + 1, len(a)):
if a[k] < a[least]:
least = k
tmp = a[i]
a[i] = a[k]
a[k] = tmp
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
f5dc8223-cf9e-429f-aae8-350d82da1982
| 2,016 |
11,029 |
def selection_sort(a):
for i in range(len(a)):
mini = min(a[i:])
min_index = a[i:].index(mini)
a[i + min_index] = a[i]
a[i] = mini
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
f5dc8223-cf9e-429f-aae8-350d82da1982
| 2,016 |
12,824 |
def selection_sort(a):
for i in range(len(a)):
mini = min(a[i:])
min_index = a[i:].index(mini)
a[i + min_index] = a[i]
a[i] = mini
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
f5dc8223-cf9e-429f-aae8-350d82da1982
| 2,016 |
30,961 |
def selection_sort(a):
for i in range(len(a)):
mini = min(a[i:])
min_index = a[i:].index(mini)
a[i + min_index] = a[i]
a[i] = mini
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
f5dc8223-cf9e-429f-aae8-350d82da1982
| 2,016 |
21,899 |
def fibonacci(n):
if n == 0 or n == 1:
return 1
else:
return fibonacci(n - 1) + fibonacci(n - 2)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| false |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
23,102 |
def fibonacci(n):
if n == 0 or n == 1:
return 1
else:
return fibonacci(n - 1) + fibonacci(n - 2)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| false |
a49f3af8-fb92-43d5-945c-abc11916e319
| 2,016 |
37,525 |
def rectangle_perimeter(x, y):
return 2 * x + 2 * y
|
rectangle_perimeter
|
rectangle_perimeter
|
Return the perimeter of a rectangle with the given coordinates.
|
assert rectangle_perimeter(0,0)==0 and rectangle_perimeter(7968917888512863576,-18677)==15937835777025689798
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
15,927 |
def square_perimeter(x):
return x * 4
|
square_perimeter
|
square_perimeter
|
Returns the perimeter of a square.
|
assert square_perimeter(0)==0 and square_perimeter(-12684)==-50736
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
10,598 |
def circle_circumference(r):
return 2 * 3.14 * r
|
circle_circumference
|
circle_circumference
|
Return the circumference of a circle.
|
assert circle_circumference(0)==0.0 and circle_circumference(25619)==160887.32
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
31,765 |
def circle_area(r):
return r * r * 3.141
|
circle_area
|
circle_area
|
Return the area of a circle.
|
assert circle_area(0)==0.0 and circle_area(-1160877629)==4.231579770269758e+18
| false |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
8,609 |
def square_area(x, y):
area = x * y
if 0 <= area:
return area
else:
return -area
|
square_area
|
square_area
|
Return the area of a square.
|
assert square_area(0)==0 and square_area(21138)==446815044
| false |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
32,860 |
def circle_area(r):
return r * r * 3.141
|
circle_area
|
circle_area
|
Return the area of a circle.
|
assert circle_area(0)==0.0 and circle_area(-1160877629)==4.231579770269758e+18
| false |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
11,483 |
def rectangle_perimeter(x, y):
return 2 * x + 2 * y
|
rectangle_perimeter
|
rectangle_perimeter
|
Return the perimeter of a rectangle with the given coordinates.
|
assert rectangle_perimeter(0,0)==0 and rectangle_perimeter(7968917888512863576,-18677)==15937835777025689798
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
18,466 |
def square_perimeter(x):
return x * 4
|
square_perimeter
|
square_perimeter
|
Returns the perimeter of a square.
|
assert square_perimeter(0)==0 and square_perimeter(-12684)==-50736
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
4,216 |
def circle_circumference(r):
return 2 * 3.14 * r
|
circle_circumference
|
circle_circumference
|
Return the circumference of a circle.
|
assert circle_circumference(0)==0.0 and circle_circumference(25619)==160887.32
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
859 |
def circle_circumference(r):
return 2 * 3.14 * r
|
circle_circumference
|
circle_circumference
|
Return the circumference of a circle.
|
assert circle_circumference(0)==0.0 and circle_circumference(25619)==160887.32
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
36,936 |
def square_area(x):
area = x * x
return area
|
square_area
|
square_area
|
Return the area of a square.
|
assert square_area(0)==0 and square_area(21138)==446815044
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
20,910 |
def rectangle_perimeter(x, y):
return 2 * x + 2 * y
|
rectangle_perimeter
|
rectangle_perimeter
|
Return the perimeter of a rectangle with the given coordinates.
|
assert rectangle_perimeter(0,0)==0 and rectangle_perimeter(7968917888512863576,-18677)==15937835777025689798
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
31,590 |
def circle_area(r):
return r * r * 3.141
|
circle_area
|
circle_area
|
Return the area of a circle.
|
assert circle_area(0)==0.0 and circle_area(-1160877629)==4.231579770269758e+18
| false |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
6,952 |
def square_perimeter(x):
return x * 4
|
square_perimeter
|
square_perimeter
|
Returns the perimeter of a square.
|
assert square_perimeter(0)==0 and square_perimeter(-12684)==-50736
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
5,921 |
def rectangle_perimeter(x, y):
return 2 * x + 2 * y
|
rectangle_perimeter
|
rectangle_perimeter
|
Return the perimeter of a rectangle with the given coordinates.
|
assert rectangle_perimeter(0,0)==0 and rectangle_perimeter(7968917888512863576,-18677)==15937835777025689798
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
28,204 |
def circle_circumference(r):
return 2 * 3.14 * r
|
circle_circumference
|
circle_circumference
|
Return the circumference of a circle.
|
assert circle_circumference(0)==0.0 and circle_circumference(25619)==160887.32
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
28,837 |
def square_perimeter(x):
return x * 4
|
square_perimeter
|
square_perimeter
|
Returns the perimeter of a square.
|
assert square_perimeter(0)==0 and square_perimeter(-12684)==-50736
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
13,425 |
def circle_area(r):
return r * r * 3.14
|
circle_area
|
circle_area
|
Return the area of a circle.
|
assert circle_area(0)==0.0 and circle_area(-1160877629)==4.231579770269758e+18
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
38,533 |
def circle_area(r):
return r * r * 3.14
|
circle_area
|
circle_area
|
Return the area of a circle.
|
assert circle_area(0)==0.0 and circle_area(-1160877629)==4.231579770269758e+18
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
26,447 |
def circle_circumference(r):
return 2 * 3.14 * r
|
circle_circumference
|
circle_circumference
|
Return the circumference of a circle.
|
assert circle_circumference(0)==0.0 and circle_circumference(25619)==160887.32
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
22,523 |
def square_area(x):
area = x * x
return area
|
square_area
|
square_area
|
Return the area of a square.
|
assert square_area(0)==0 and square_area(21138)==446815044
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
14,863 |
def square_perimeter(x):
return x * 4
|
square_perimeter
|
square_perimeter
|
Returns the perimeter of a square.
|
assert square_perimeter(0)==0 and square_perimeter(-12684)==-50736
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
9,227 |
def rectangle_perimeter(x, y):
return 2 * x + 2 * y
|
rectangle_perimeter
|
rectangle_perimeter
|
Return the perimeter of a rectangle with the given coordinates.
|
assert rectangle_perimeter(0,0)==0 and rectangle_perimeter(7968917888512863576,-18677)==15937835777025689798
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
6,127 |
def square_area(x):
area = x * x
return area
|
square_area
|
square_area
|
Return the area of a square.
|
assert square_area(0)==0 and square_area(21138)==446815044
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
2,336 |
def reverse(a):
print(a[::-1])
|
reverse_iter
|
reverse
|
Iteratively reverse a list of elements.
|
assert reverse([])==[] and reverse([20, 10, 0, -10, -20])==[-20, -10, 0, 10, 20] and reverse(['toto', True, [10, 0, 9], 12.8, 6])==[6, 12.8, [10, 0, 9], True, 'toto']
| false |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
16 |
def reverse(a):
print(a.reverse())
|
reverse_iter
|
reverse
|
Iteratively reverse a list of elements.
|
assert reverse([])==[] and reverse([20, 10, 0, -10, -20])==[-20, -10, 0, 10, 20] and reverse(['toto', True, [10, 0, 9], 12.8, 6])==[6, 12.8, [10, 0, 9], True, 'toto']
| false |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
29,153 |
def reverse(a):
return a.reverse()
|
reverse_iter
|
reverse
|
Iteratively reverse a list of elements.
|
assert reverse([])==[] and reverse([20, 10, 0, -10, -20])==[-20, -10, 0, 10, 20] and reverse(['toto', True, [10, 0, 9], 12.8, 6])==[6, 12.8, [10, 0, 9], True, 'toto']
| false |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
36,462 |
def reverse(a):
return a[::-1]
|
reverse_iter
|
reverse
|
Iteratively reverse a list of elements.
|
assert reverse([])==[] and reverse([20, 10, 0, -10, -20])==[-20, -10, 0, 10, 20] and reverse(['toto', True, [10, 0, 9], 12.8, 6])==[6, 12.8, [10, 0, 9], True, 'toto']
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
3,867 |
def reverse(a):
return a[::-1]
|
reverse_iter
|
reverse
|
Iteratively reverse a list of elements.
|
assert reverse([])==[] and reverse([20, 10, 0, -10, -20])==[-20, -10, 0, 10, 20] and reverse(['toto', True, [10, 0, 9], 12.8, 6])==[6, 12.8, [10, 0, 9], True, 'toto']
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
9,604 |
def square_area(x):
return x ** 2
|
square_area
|
square_area
|
Return the area of a square.
|
assert square_area(0)==0 and square_area(21138)==446815044
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
11,708 |
def square_area(x):
return x ** 2
|
square_area
|
square_area
|
Return the area of a square.
|
assert square_area(0)==0 and square_area(21138)==446815044
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
35,587 |
def square_area(x):
return x ** 2
|
square_area
|
square_area
|
Return the area of a square.
|
assert square_area(0)==0 and square_area(21138)==446815044
| true |
03141ef3-f364-4b7c-9f52-990a173ac162
| 2,016 |
15,806 |
def double(x):
y = x * 2
return y
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
7,532 |
def double(x):
y = x * 2
return y
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
28,657 |
def double(x):
y = x * 2
return y
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
16,883 |
def double(x):
y = x * 2
return y
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
18,439 |
def double(x):
y = x * 2
return y
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
4,080 |
def area(r):
y = pi * r * r
return y
|
area
|
area
|
Return the area of a circle with the given coordinates.
|
assert area(0)==0.0 and area(-14329)==644910876.981
| false |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
8,733 |
def circumference(r):
y = 2 * pi * r
return y
|
circumference
|
circumference
|
Return the circumference of a circle.
|
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
| false |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
14,569 |
def circumference(r):
y = 2 * pi * r
return y
|
circumference
|
circumference
|
Return the circumference of a circle.
|
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
| false |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
37,667 |
def area(r):
y = pi * r * r
return y
|
area
|
area
|
Return the area of a circle with the given coordinates.
|
assert area(0)==0.0 and area(-14329)==644910876.981
| false |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
29,533 |
def swap(a, i, j):
y = a[j]
a[j] = a[i]
a[i] = y
def reverse(a):
i = 0
while i < len(a) / 2:
swap(a, i, len(a) - i - 1)
i = i + 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
15,931 |
def swap(a, i, j):
y = a[j]
a[j] = a[i]
a[i] = y
def reverse(a):
i = 0
while i < len(a) / 2:
swap(a, i, len(a) - i - 1)
i = i + 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
5,911 |
def swap(a, i, j):
y = a[j]
a[j] = a[i]
a[i] = y
def reverse(a):
i = 0
while i < len(a) / 2:
swap(a, i, len(a) - i - 1)
i = i + 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
10,186 |
def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
12,529 |
def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
36,067 |
def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
28,590 |
def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
3,697 |
def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
13,169 |
def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
8,705 |
def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
30,215 |
def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
31,883 |
def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
4,919 |
def append2list(l1, l2=[]):
l2 = l1
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| false |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
19,827 |
def append2list(l1, l2=[]):
for i in l1:
if len(l2) <= 2:
l2.append(i)
else:
l2 = l1
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| false |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
8,034 |
def append2list(l1, l2=[]):
for i in l1:
if len(l2) <= 2:
l2.append(i)
else:
l2 = l1
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| false |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
21,865 |
def append2list(l1, l2=None):
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
32,284 |
def append2list(l1, l2=None):
for i in l1:
try:
l2.append(i)
except AttributeError:
continue
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
12,083 |
def append2list(l1, l2):
for i in l1:
try:
l2.append(i)
except AttributeError:
continue
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
24,381 |
def append2list(l1, l2=''):
for i in l1:
try:
l2.append(i)
except AttributeError:
continue
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
12,268 |
def append2list(l1, l2=[]):
for i in l1:
try:
l2.append(i)
except AttributeError:
continue
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
20,115 |
def append2list(l1, l2=[]):
for i in l1:
try:
l1 = []
l2.append(i)
except AttributeError:
continue
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
6,012 |
def append2list(l1, l2=[]):
for i in l1:
try:
l1 = []
l2 = []
l2.append(i)
except AttributeError:
continue
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| false |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
20,205 |
def append2list(l1, l2=None):
if l2 == None:
l2 = []
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
25,337 |
def append2list(l1, l2=None):
if l2 == None:
l2 = []
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
11,443 |
def append2list(l1, l2=None):
if l2 == None:
l2 = []
for i in l1:
l2.append(i)
return l2
|
append2list
|
append2list
|
Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list.
|
assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267]
| true |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
14,888 |
def swap_keys_values(d):
dictionary = {}
for k, v in list(d.items()):
dictionary[v] = k
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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
34,174 |
def swap_keys_values(d):
dictionary = {}
for k, v in list(d.items()):
dictionary[v] = k
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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
18,926 |
def swap_unique_keys_values(d):
dictionary = {}
unique = set(d.values())
for k, v in list(d.items()):
if v in unique:
dictionary[v] = k
return dictionary
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
15,951 |
def swap_unique_keys_values(d):
dictionary = {}
unique = []
for k, v in list(d.items()):
unique.append((k, v))
print(unique)
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
41,353 |
def swap_unique_keys_values(d):
dictionary = {}
unique = []
for k, v in list(d.items()):
unique.append((k, v))
for k, v in unique:
if unique.count(v) > 1:
del unique[k, v]
print(unique)
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
36,838 |
def swap_unique_keys_values(d):
dictionary = {}
unique = []
for k, v in list(d.items()):
unique.append((k, v))
for k, v in unique:
print(v)
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
37,746 |
def swap_unique_keys_values(d):
dictionary = {}
unique = []
for k, v in list(d.items()):
unique.append((k, v))
for k, v in unique:
if unique.count(v) > 1:
print(v)
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
22,039 |
def swap_unique_keys_values(d):
dictionary = {}
unique = []
for k, v in list(d.items()):
unique.append((k, v))
for k, v in unique:
if unique.count(v) > 1:
print(v)
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
2,566 |
def swap_unique_keys_values(d):
dictionary = {}
unique = []
for k, v in list(d.items()):
unique.append((k, v))
for k, v in unique:
if unique.count(v) > 1:
print(v)
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
21,251 |
def swap_unique_keys_values(d):
dictionary = {}
unique = []
for k, v in list(d.items()):
unique.append((k, v))
for k, v in unique:
if unique.count(v) > 1:
print(v)
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
27,923 |
def swap_unique_keys_values(d):
dictionary = {}
unique = []
deli = []
for k, v in list(d.items()):
unique.append(v)
for v in unique:
if unique.count(v) > 1:
deli.append(v)
for v in unique:
if v in deli:
del unique[v]
for k, v in list(d.items()):
if v in unique:
dictionary[v] = k
return dictionary
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
27,040 |
def swap_unique_keys_values(d):
dictionary = {}
unique = []
deli = []
for k, v in list(d.items()):
unique.append(v)
for v in unique:
if unique.count(v) > 1:
deli.append(v)
for v in unique:
try:
if v in deli:
del unique[v]
except:
continue
for k, v in list(d.items()):
if v in unique:
dictionary[v] = k
return dictionary
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
29,070 |
def swap_unique_keys_values(d):
dictionary = {}
counter = []
new = []
for k, v in list(d.items()):
counter.append(v)
for c in counter:
if counter.count(c) == 1:
new.append(c)
for k, v in list(d.items()):
if v in new:
dictionary[v] = k
return dictionary
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
30,599 |
def swap_unique_keys_values(d):
dictionary = {}
counter = []
new = []
for k, v in list(d.items()):
counter.append(v)
for c in counter:
if counter.count(c) == 1:
new.append(c)
for k, v in list(d.items()):
if v in new:
dictionary[v] = k
return dictionary
|
swap_unique_keys_values
|
swap_unique_keys_values
|
Swap the keys of a dictionary with its unique values.
|
assert swap_unique_keys_values({})=={} and swap_unique_keys_values({'1': 'a'})=={'a': '1'} and swap_unique_keys_values({'1': 'a', '2': 'b', '3': '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 |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
39,342 |
def double(n):
return n * 2
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
4,678 |
def double(n):
return n * 2
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
22,209 |
def circumference(r):
return 2 * pi * r
|
circumference
|
circumference
|
Return the circumference of a circle.
|
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
| false |
11fcbbcf-716f-4e92-ab7c-407d4712c9e8
| 2,016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.