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
|
---|---|---|---|---|---|---|---|---|
30,090 | def power(x, y):
if y == 0:
return 1
return x * power(x, y - 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 | bd03ecd6-cea3-4854-803a-b14d429489a7 | 2,016 |
17,334 | def power(x, y):
if y == 0:
return 1
return x * power(x, y - 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 | bd03ecd6-cea3-4854-803a-b14d429489a7 | 2,016 |
18,164 | def count_letters(n):
if len(n) == 1:
return n[0]
return 1 + count_letters(n[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 | false | 31fe4020-d4b7-4bf5-ac95-b28807a90ae8 | 2,016 |
40,072 | def count_letters(n):
if len(n) == 1:
return n[0]
return 1 + count_letters(n[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 | false | 31fe4020-d4b7-4bf5-ac95-b28807a90ae8 | 2,016 |
24,037 | def count_letters(n):
if len(n) == 1:
return n[0]
return 1 + count_letters(n[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 | false | 31fe4020-d4b7-4bf5-ac95-b28807a90ae8 | 2,016 |
21,912 | def minimum(a):
if len(a) == 1:
return a[0]
else:
return min(a[0], minimum(a[1:])) | 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
7,163 | def minimum(a):
if len(a) == 1:
return a[0]
else:
return min(a[0], minimum(a[1:])) | 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
4,891 | def maximum(list):
if len(list) == 1:
return list[0]
else:
m = maximum(list[1:])
return m if m > list[0] else list[0] | 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
10,053 | def maximum(list):
if len(list) == 1:
return list[0]
else:
m = maximum(list[1:])
return m if m > list[0] else list[0] | 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
14,805 | def count_letters(s):
if not 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
5,359 | def count_letters(s):
if not 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
22,142 | def reverse_list(l):
reversedlist = []
i = len(l) - 1
while i > -1:
reversedlist.append(l[i])
i = i - 1
return reversedlist | 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 | 88e97329-9c3f-4e1a-8643-1311f4e801a9 | 2,016 |
13,688 | def reverse_list(l):
reversedlist = []
i = len(l) - 1
while i > -1:
reversedlist.append(l[i])
i = i - 1
return reversedlist | 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 | 88e97329-9c3f-4e1a-8643-1311f4e801a9 | 2,016 |
22,202 | def reverse_list(l):
reversedlist = []
i = len(l) - 1
while i > -1:
reversedlist.append(l[i])
i = i - 1
return reversedlist | 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 | 88e97329-9c3f-4e1a-8643-1311f4e801a9 | 2,016 |
3,506 | def reverse_list(l):
if l == []:
return []
tmp = reverse_list(l[1:])
tmp.append(l[0])
return tmp | 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
32,560 | def reverse_list(l):
if l == []:
return []
tmp = reverse_list(l[1:])
tmp.append(l[0])
return tmp | 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
1,426 | def fibonacci(n):
if 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
29,904 | def fibonacci(n):
if 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
34,011 | 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
30,822 | 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 | 2157ade0-6890-435b-8669-a884e3233bc7 | 2,016 |
34,777 | def minimum(a):
lowest = sum(a)
for e in a:
if e < lowest:
lowest = e
return lowest | 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 | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
2,954 | def minimum(a):
lowest = sum(a)
for e in a:
if e < lowest:
lowest = e
return lowest | 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 | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
17,143 | def maximum(a):
highest = 0
for e in a:
if e > highest:
highest = e
return highest | 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 | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
33,418 | def maximum(a):
highest = 0
for e in a:
if e > highest:
highest = e
return highest | 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 | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
15,535 | def count_letters(s):
l = 0
for e in s:
l += 1
return l | 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 | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
28,979 | def count_letters(s):
l = 0
for e in s:
l += 1
return l | 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 | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
41,352 | def fibonacci(n):
if 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
22,628 | def fibonacci(n):
if 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
15,195 | 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
17,566 | 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
12,844 | def maximum(s):
if len(s) == 1:
return s[0]
else:
maxi = maximum(s[1:])
return s[0] if s[0] > maxi else maxi | 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
6,413 | def maximum(s):
if len(s) == 1:
return s[0]
else:
maxi = maximum(s[1:])
return s[0] if s[0] > maxi else maxi | 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
29,191 | def power(m, n):
if n == 0:
return 1
else:
return m ** 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
30,789 | def power(m, n):
if n == 0:
return 1
else:
return m ** 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
27,071 | def reverse_list(s):
if len(s) == 0:
return []
else:
return [s[-1]] + reverse_list(s[:-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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
17,129 | def reverse_list(s):
if len(s) == 0:
return []
else:
return [s[-1]] + reverse_list(s[:-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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
31,323 | def power(x, n):
if x == 0:
return 1
return x * power(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 | false | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
11,050 | def power(x, n):
if x == 0:
return 1
return x * power(x, 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 | false | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
3,958 | def power(x, n):
if n == 0:
return 1
return x * power(x, 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 | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
13,020 | def power(x, n):
if n == 0:
return 1
return x * power(x, 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 | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
20,319 | 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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
9,743 | 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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
28,520 | def power(a, b):
if b == 1:
return a
if b == 0:
return 1
return a * power(a, b - 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
13,100 | def power(a, b):
if b == 1:
return a
if b == 0:
return 1
return a * power(a, b - 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
11,594 | 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 | 6668ebd6-a850-4666-b8cc-5c934a67601a | 2,016 |
32,107 | 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 | 6668ebd6-a850-4666-b8cc-5c934a67601a | 2,016 |
26,220 | def selectionsort(m):
for i in range(len(m)):
n = i
for j in range(i, len(m)):
if m[j] < m[n]:
n = j
m[i], m[n] = m[n], m[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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
11,123 | def selectionsort(m):
for i in range(len(m)):
min_j = i
for j in range(i, len(m)):
if m[j] < m[min_j]:
min_j = j
m[i], m[min_j] = m[min_j], m[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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
20,350 | 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() | 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
14,628 | 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
7,325 | 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
40,807 | def selectionsort(m):
for i in range(len(m)):
n = i
for j in range(i, len(m)):
if m[j] < m[n]:
n = j
m[i], m[n] = m[n], m[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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
34,059 | def selectionsort(m):
for i in range(len(m)):
n = i
for j in range(i, len(m)):
if m[j] < m[n]:
n = j
m[i], m[n] = m[n], m[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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
9,963 | def selectionsort(m):
for i in range(len(m)):
n = i
for j in range(i, len(m)):
if m[j] < m[n]:
n = j
m[i], m[n] = m[n], m[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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
20,179 | 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
9,702 | 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
22,274 | def count_letters(l):
letter_sum = 0
for k in l:
letter_sum += 1
return count_letters(l) | 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
27,964 | def quicksort(l, beg, fin):
if fin - beg < 1:
return
i = j = beg
while i <= fin:
if l[i] <= l[fin]:
l[i], l[j] = l[j], l[i]
j += 1
i += 1
quicksort(l, beg, j - 2)
quicksort(l, j, fin) | 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
7,436 | def quicksort(l, beg, fin):
if fin - beg < 1:
return
i = j = beg
while i <= fin:
if l[i] <= l[fin]:
l[i], l[j] = l[j], l[i]
j += 1
i += 1
quicksort(l, beg, j - 2)
quicksort(l, j, fin) | 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
23,415 | 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
19,635 | 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
24,213 | def minimum(s):
if len(s) == 1:
return s[0]
else:
min_ret = minimum(s[1:])
return s[0] if s[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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
3,952 | def minimum(s):
if len(s) == 1:
return s[0]
else:
min_ret = minimum(s[1:])
return s[0] if s[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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
30,886 | def count_letters(l):
return 1 + count_letters(s[1:]) if l else 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
38,017 | def count_letters(l):
return 1 + count_letters(l[1:]) if l else 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 | true | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
5,960 | def count_letters(l):
return 1 + count_letters(l[1:]) if l else 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 | true | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
3,139 | def fibonacci(n):
a, b = 1, 1
for i in range(n - 1):
a, b = b, a + b
return a | 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 | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
40,452 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
dist = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
return dist < r1 + r2 | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | true | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
4,456 | 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
6,457 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
dist = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
return dist < r1 + r2 | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | true | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
40,957 | 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 | 61b5b70e-4e9d-424d-ba4b-cab01b8c205f | 2,016 |
10,063 | def fibonacci(n):
a, b = 1, 1
for i in range(n):
a, b = b, a + b
return a | 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 | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
18,431 | def fibonacci(n):
a, b = 1, 1
for i in range(n):
a, b = b, a + b
return a | 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 | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
23,794 | def reverse_list(l):
for i in reversed(l):
return reverse_list(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] | false | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
15,883 | def minimum(l):
if len(l) == 1:
return l[0]
if l[0] < l[-1]:
return minimum(l[:-1])
else:
return minimum(l[1:]) | 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 | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
24,722 | def minimum(l):
if len(l) == 1:
return l[0]
if l[0] < l[-1]:
return minimum(l[:-1])
else:
return minimum(l[1:]) | 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 | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
17,404 | def reverse_list(l):
return l.reverse() | 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
185 | def reverse_list(l):
return [x for x in reversed(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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
6,287 | def reverse_list(l):
return [x for x in reversed(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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
10,701 | def fibonacci(a):
if a == 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
24,972 | def fibonacci(a):
if a == 0:
return 1
elif 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
30,777 | def fibonacci(a):
if a == 0:
return 1
elif 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
39,385 | def fibonacci(a):
if a == 0:
return 1
elif 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 | 477d4ab3-7007-4ba6-b1ff-797966495e9d | 2,016 |
21,005 | def maximum(l):
if len(l) == 1:
return l[0]
if l[0] < l[-1]:
return maximum(l[1:])
else:
return maximum(l[:-1]) | 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 | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
27,479 | def maximum(l):
if len(l) == 1:
return l[0]
if l[0] < l[-1]:
return maximum(l[1:])
else:
return maximum(l[:-1]) | 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 | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
3,172 | 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
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1
return a | 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 | false | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
13,234 | 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
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1
return a | 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 | false | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
41,870 | 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
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1
return a | 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 | false | 6f8302a0-5974-4b36-a8e9-6b3968a8fce1 | 2,016 |
3,148 | 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 | 652b3384-e559-46c5-81db-1bf2117db63b | 2,016 |
34,571 | 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 | 652b3384-e559-46c5-81db-1bf2117db63b | 2,016 |
16,986 | 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 | 652b3384-e559-46c5-81db-1bf2117db63b | 2,016 |
25,154 | 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 | 652b3384-e559-46c5-81db-1bf2117db63b | 2,016 |
14,823 | def minimum(l):
if len(l) == 1:
return l[0]
else:
m = minimum(l[1:])
if m < l[0]:
return m
else:
return l[0] | 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 | 6668ebd6-a850-4666-b8cc-5c934a67601a | 2,016 |
18,210 | def minimum(l):
if len(l) == 1:
return l[0]
else:
m = minimum(l[1:])
if m < l[0]:
return m
else:
return l[0] | 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 | 6668ebd6-a850-4666-b8cc-5c934a67601a | 2,016 |
12,232 | 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 | 652b3384-e559-46c5-81db-1bf2117db63b | 2,016 |
36,787 | 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 | 652b3384-e559-46c5-81db-1bf2117db63b | 2,016 |
26,031 | def maximum(l):
if len(l) == 1:
return l[0]
else:
m = maximum(l[1:])
if m > l[0]:
return m
else:
return l[0] | 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 | 6668ebd6-a850-4666-b8cc-5c934a67601a | 2,016 |
8,558 | def maximum(l):
if len(l) == 1:
return l[0]
else:
m = maximum(l[1:])
if m > l[0]:
return m
else:
return l[0] | 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 | 6668ebd6-a850-4666-b8cc-5c934a67601a | 2,016 |
7,385 | def count_letters(s):
if s == '':
return 0
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 | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
1,932 | def count_letters(s):
if s == '':
return 0
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 | caddc359-e5b0-41d8-94ab-df712d5ea9ce | 2,016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.