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
|
---|---|---|---|---|---|---|---|---|
22,519 | def count_letters(a):
if a == '':
return 0
a = a[:-1]
n = 1
return n + count_letters(a) | 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 | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
10,572 | def count_letters(a):
if a == '':
return 0
a = a[:-1]
n = 1
return n + count_letters(a) | 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 | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
5,228 | def power(n, mult):
if mult == 0:
return 0
n * n
power(n, mult - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | false | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
14,185 | def power(n, mult):
if mult == 0:
return 0
return n ** mult
power(n, mult - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | false | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
23,687 | def power(n, mult):
return n ** mult
power(n, mult - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
40,889 | def power(n, mult):
return n ** mult
power(n, mult - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
741 | def reverse_list(a):
b = []
i = 0
while i < len(a):
b.append(a.pop())
i = i + 1
return b | 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 | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
41,299 | def reverse_list(a):
b = []
i = 0
while i < len(a):
b.append(a.pop())
i = i + 1
return b | 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 | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
22,550 | def power(n, m):
if m == 1:
return n
if m == 0:
return 1
return n * power(n, m - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
22,898 | def power(n, m):
if m == 1:
return n
if m == 0:
return 1
return n * power(n, m - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
41,032 | def fibonacci(a):
if a == 0 or a == 1:
return 1
return fibonacci(a - 1) + fibonacci(a - 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 | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
20,982 | def fibonacci(a):
if a == 0 or a == 1:
return 1
return fibonacci(a - 1) + fibonacci(a - 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 | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
5,843 | def minimum(l):
if len(l) == 1:
return l[0]
if l[0] < l[1]:
l.remove(l[1])
else:
l.remove(l[0])
return minimum(l) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
14,591 | def minimum(l):
if len(l) == 1:
return l[0]
if l[0] < l[1]:
l.remove(l[1])
else:
l.remove(l[0])
return minimum(l) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
9,884 | def maximum(l):
if len(l) == 1:
return l[0]
if l[0] > l[1]:
l.remove(l[1])
else:
l.remove(l[0])
return maximum(l) | 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 | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
26,709 | def maximum(l):
if len(l) == 1:
return l[0]
if l[0] > l[1]:
l.remove(l[1])
else:
l.remove(l[0])
return maximum(l) | 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 | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
42,478 | def fibonacci(n):
if n == 0:
return 1
elif n == 1:
return 1
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 | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
869 | def fibonacci(n):
if n == 0:
return 1
elif n == 1:
return 1
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 | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
38,821 | def selectionsort(A):
for i in range(len(A)):
min_j = i
for j in range(i, len(A)):
if A[j] < A[min_j]:
min_j = j
A[i], A[min_j] = A[min_j], A[i] | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
410 | def selectionsort(A):
for i in range(len(A)):
min_j = i
for j in range(i, len(A)):
if A[j] < A[min_j]:
min_j = j
A[i], A[min_j] = A[min_j], A[i] | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
12,333 | def minimum(lis, p=0):
if lis == []:
return p
n = pop(lis)
if n > p:
p = n
return minimum(lis) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
33,064 | def quicksort(A, start, end):
if end - start < 1:
return
i = j = start
while i <= end:
if A[i] <= A[end]:
A[i], A[j] = A[j], A[i]
j += 1
i += 1
quicksort(A, start, j - 2)
quicksort(A, j, end) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
26,519 | def quicksort(A, start, end):
if end - start < 1:
return
i = j = start
while i <= end:
if A[i] <= A[end]:
A[i], A[j] = A[j], A[i]
j += 1
i += 1
quicksort(A, start, j - 2)
quicksort(A, j, end) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
19,613 | def minimum(lis, p=0):
if lis == []:
return p
n = lis.pop()
if n > p:
p = n
return minimum(lis) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
7,207 | def minimum(lis, p=0):
if lis == []:
return p
n = lis.pop()
if n > p:
p = n
return minimum(lis, p) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
21,702 | def count_letters(s):
if s == '':
return 0
else:
return 1 + count_letters(s[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 | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
35,090 | def count_letters(s):
if s == '':
return 0
else:
return 1 + count_letters(s[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 | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
23,798 | def reverse_list(l):
if len(l) == 0:
return []
else:
return [l[-1]] + reverse_list(l[:-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 | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
27,487 | def reverse_list(l):
if len(l) == 0:
return []
else:
return [l[-1]] + reverse_list(l[:-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 | fccb16a1-abd7-4ee8-a2c6-5b7653d7a7dc | 2,016 |
1,140 | def minimum(lis, p=100000000000000000000000000000000000000000000):
if lis == []:
return p
n = lis.pop()
if n < p:
p = n
return minimum(lis, p) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
38,261 | def minimum(lis, p=100000000000000000000000000000000000000000000):
if lis == []:
return p
n = lis.pop()
if n < p:
p = n
return minimum(lis, p) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
2,861 | def maximum(lis, p=0):
if lis == []:
return p
n = lis.pop()
if n > p:
p = n
return minimum(lis, p) | 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 | false | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
9,518 | def maximum(lis, p=0):
if lis == []:
return p
n = lis.pop()
if n > p:
p = n
return maximum(lis, p) | 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 | false | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
3,832 | def maximum(lis, p=0):
if lis == []:
return p
n = lis.pop()
if n > p:
p = n
return maximum(lis, p) | 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 | false | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
36,153 | def count_letters(s, c=0):
if s == '':
return c
s = s[1:]
c = c + 1
return count_letters(s) | 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 | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
34,720 | def count_letters(s, c=0):
if s == '':
return c
s = s[1:]
c = c + 1
return count_letters(s, c) | 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 | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
14,251 | def count_letters(s, c=0):
if s == '':
return c
s = s[1:]
c = c + 1
return count_letters(s, c) | 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 | e5db5e57-0261-4967-963a-42d1a98c03de | 2,016 |
2,481 | def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
6,427 | def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
28,604 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
a[i], a[p] = a[p], a[i]
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
34,440 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
a[i], a[p] = a[p], a[i]
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 030c2a56-757a-4b4d-ac91-67aecc3d9b33 | 2,016 |
11,727 | 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 | 31fe4020-d4b7-4bf5-ac95-b28807a90ae8 | 2,016 |
5,811 | 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 | 31fe4020-d4b7-4bf5-ac95-b28807a90ae8 | 2,016 |
17,121 | def reverse_list(l):
if l == []:
return []
temp = reverse_list(l[1:])
temp.append(l[0])
return temp | 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 | 2f34a0ed-0d6a-447e-8e47-6a90f11d53a7 | 2,016 |
34,940 | def reverse_list(l):
if l == []:
return []
temp = reverse_list(l[1:])
temp.append(l[0])
return temp | 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 | 2f34a0ed-0d6a-447e-8e47-6a90f11d53a7 | 2,016 |
17,151 | def fibonacci(n):
if n == 0 or n == 1 or n == 2:
return 1
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 | 2f34a0ed-0d6a-447e-8e47-6a90f11d53a7 | 2,016 |
1,584 | def fibonacci(n):
if n == 0 or n == 1 or n == 2:
return 1
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 | 2f34a0ed-0d6a-447e-8e47-6a90f11d53a7 | 2,016 |
25,907 | def power(base, exp):
if exp == 0:
return 1
elif exp == 1:
return base
else:
base *= base
new_exp = exp - 1
power(base, exp) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | false | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
27,282 | def power(base, exp):
if exp == 0:
return 1
elif exp == 1:
return base
else:
base *= base
new_exp = exp - 1
power(base, new_exp) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | false | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
3,011 | def power(base, exp):
if exp == 0:
return 1
elif exp == 1:
return base
else:
base *= base
new_exp = exp - 1
return power(base, new_exp) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | false | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
19,500 | def power(base, exp):
if exp == 0:
return 1
elif exp == 1:
return base
else:
new_base = base * base
new_exp = exp - 1
return power(new_base, new_exp) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | false | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
32,413 | 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 | 2f34a0ed-0d6a-447e-8e47-6a90f11d53a7 | 2,016 |
34,993 | 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 | 2f34a0ed-0d6a-447e-8e47-6a90f11d53a7 | 2,016 |
34,390 | 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 | 2f34a0ed-0d6a-447e-8e47-6a90f11d53a7 | 2,016 |
11,250 | def power(base, exp, mult=None):
if mult is None:
mult = base
if exp == 0:
return 1
elif exp == 1:
return base
else:
new_base = base * mult
new_exp = exp - 1
return power(new_base, new_exp, mult) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
23,281 | def power(base, exp, mult=None):
if mult is None:
mult = base
if exp == 0:
return 1
elif exp == 1:
return base
else:
new_base = base * mult
new_exp = exp - 1
return power(new_base, new_exp, mult) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
27,292 | def minimum(l):
min = inf
for item in l:
min = item if item < min else min
return min | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
2,504 | def minimum(l):
min = None
for item in l:
min = item if min == None or item < min else min
return min | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
38,645 | def maximum(l):
min = None
for item in l:
min = item if min == None or item > min else min
return min | 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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
9,150 | def maximum(l):
max = None
for item in l:
max = item if max == None or item > max else max
return max | 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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
14,802 | def maximum(l, old_max=None):
item = l[0]
if item != None:
new_l = l[1:]
maximum(new_l, item if old_max == None or item > old_max else old_max)
else:
return old_max | 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 | false | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
36,796 | _A = None
def maximum(l, old_max=_A):
try:
item = l[0]
except IndexError:
item = _A
if item is not _A:
new_l = l[1:]
maximum(new_l, item if old_max == _A or item > old_max else old_max)
else:
return old_max | 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 | false | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
32,786 | _A = None
def maximum(l, old_max=_A):
try:
item = l[0]
except IndexError:
item = _A
if item is not _A:
new_l = l[1:]
return maximum(new_l, item if old_max == _A or item > old_max else
old_max)
else:
return old_max | 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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
40,750 | _A = None
def maximum(l, old_max=_A):
try:
item = l[0]
except IndexError:
item = _A
if item is not _A:
new_l = l[1:]
return maximum(new_l, item if old_max == _A or item > old_max else
old_max)
else:
return old_max | 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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
32,559 | _A = None
def minimum(l, old_min=_A):
try:
item = l[0]
except IndexError:
item = _A
if item is not _A:
new_l = l[1:]
return minimum(new_l, item if old_min == _A or item < old_min else
old_min)
else:
return old_min | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
39,712 | _A = None
def minimum(l, old_min=_A):
try:
item = l[0]
except IndexError:
item = _A
if item is not _A:
new_l = l[1:]
return minimum(new_l, item if old_min == _A or item < old_min else
old_min)
else:
return old_min | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
9,361 | def count_letters(item, length=0):
try:
item[0]
except IndexError:
return length
item = item[1:]
length += 1
return count_letters(item, length) | 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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
5,817 | def count_letters(item, length=0):
try:
item[0]
except IndexError:
return length
item = item[1:]
length += 1
return count_letters(item, length) | 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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
28,534 | def reverse_list(l, new_l=None):
if new_l is None:
new_l = []
if len(l) > 0:
i = l[0]
l = l[1:]
new_l = [i] + new_l
return reverse_list(l, new_l)
else:
return new_l | 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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
18,130 | def reverse_list(l, new_l=None):
if new_l is None:
new_l = []
if len(l) > 0:
i = l[0]
l = l[1:]
new_l = [i] + new_l
return reverse_list(l, new_l)
else:
return new_l | 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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
19,287 | def fibonacci(n):
return n if n < 2 else fibonacci(n - 2) + fibonacci(n - 1) | 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 | true | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
22,240 | def fibonacci(n):
return 1 if n < 2 else fibonacci(n - 2) + fibonacci(n - 1) | 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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
38,300 | def fibonacci(n):
return 1 if n < 2 else fibonacci(n - 2) + fibonacci(n - 1) | 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 | d566071f-0679-42ce-9081-3fac29a67d21 | 2,016 |
1,473 | def quicksort(A, start, end):
if end - start < 1:
return
i = j = start
while i <= end:
if A[i] <= A[end]:
A[i], A[j] = A[j], A[i]
j += 1
i += 1
quicksort(A, start, j - 2)
quicksort(A, j, end) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
16,093 | def quicksort(A, start, end):
if end - start < 1:
return
i = j = start
while i <= end:
if A[i] <= A[end]:
A[i], A[j] = A[j], A[i]
j += 1
i += 1
quicksort(A, start, j - 2)
quicksort(A, j, end) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
25,533 | def selectionsort(A):
for i in range(len(A)):
min_j = i
for j in range(i, len(A)):
if A[j] < A[min_j]:
min_j = j
A[i], A[min_j] = A[min_j], A[i] | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
24,653 | def selectionsort(A):
for i in range(len(A)):
min_j = i
for j in range(i, len(A)):
if A[j] < A[min_j]:
min_j = j
A[i], A[min_j] = A[min_j], A[i] | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
24,268 | def fibonacci(s):
if s == 0:
return 1
else:
return fibonacci(s - 1) + fibonacci(s + 5) | 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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
28,186 | def fibonacci(s):
if s == 0:
return 1
else:
return fibonacci(s - 1) + fibonacci(s - 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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
36,574 | def fibonacci(s):
if s <= 1:
return 1
else:
return fibonacci(s - 1) + fibonacci(s - 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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
20,869 | def fibonacci(s):
if s <= 1:
return 1
else:
return fibonacci(s - 1) + fibonacci(s - 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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
18,481 | def count_letters(s):
if s == '':
return 0
else:
return 1 + count_letters(s[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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
9,744 | def count_letters(s):
if s == '':
return 0
else:
return 1 + count_letters(s[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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
37,787 | def power(n, p):
if p == 0:
return 1
else:
return power(n, p - 1) * n | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
39,920 | def power(n, p):
if p == 0:
return 1
else:
return power(n, p - 1) * n | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
22,618 | def minimum(l):
if len(l) == 1:
return l[0]
else:
min_ret = minimum(l[1:])
return l[0] if l[0] < min_ret else min_ret | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
14,870 | def minimum(l):
if len(l) == 1:
return l[0]
else:
min_ret = minimum(l[1:])
return l[0] if l[0] < min_ret else min_ret | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
22,946 | def maximum(l):
if len(l) == 1:
return l[0]
else:
max_ret = maximum(l[1:])
return l[0] if l[0] > max_ret else max_ret | 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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
12,789 | def maximum(l):
if len(l) == 1:
return l[0]
else:
max_ret = maximum(l[1:])
return l[0] if l[0] > max_ret else max_ret | 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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
2,377 | def reverse_list(l):
if len(l) == 0:
return []
else:
return [l[-1]] + reverse_list(l[:-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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
11,906 | def reverse_list(l):
if len(l) == 0:
return []
else:
return [l[-1]] + reverse_list(l[:-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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
40,068 | def reverse_list(l):
if len(l) == 0:
return []
else:
return [l[-1]] + reverse_list(l[:-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 | f56d6cc3-92a7-49e7-aa07-2e1c83caaabe | 2,016 |
9,351 | def reverse_list(l):
if l == []:
return []
temp = reverse_list(l[1:])
temp.append(l[0])
return temp | 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 | 48db4273-a21e-41be-bca6-9b6444a15cbf | 2,016 |
21,694 | def reverse_list(l):
if l == []:
return []
temp = reverse_list(l[1:])
temp.append(l[0])
return temp | 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 | 48db4273-a21e-41be-bca6-9b6444a15cbf | 2,016 |
25,642 | def power(m, n):
if n == 0:
return 1
return m * power(m, n - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | a4f49b67-25e5-43c2-a48c-827c1919659f | 2,016 |
31,046 | def power(m, n):
if n == 0:
return 1
return m * power(m, n - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | a4f49b67-25e5-43c2-a48c-827c1919659f | 2,016 |
29,502 | 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 | 48db4273-a21e-41be-bca6-9b6444a15cbf | 2,016 |
35,765 | 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 | 48db4273-a21e-41be-bca6-9b6444a15cbf | 2,016 |
31,146 | def minimum(a):
if len(a) == 1:
return a[0]
if a[0] < a[1]:
a.remove(a[1])
return minimum(a)
else:
a.remove(a[0])
return minimum(a) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | a4f49b67-25e5-43c2-a48c-827c1919659f | 2,016 |
14,603 | def minimum(a):
if len(a) == 1:
return a[0]
if a[0] < a[1]:
a.remove(a[1])
return minimum(a)
else:
a.remove(a[0])
return minimum(a) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | a4f49b67-25e5-43c2-a48c-827c1919659f | 2,016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.