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
|
---|---|---|---|---|---|---|---|---|
27,315 | def minimum(numbers):
if len(numbers) == 1:
return numbers[0]
if numbers[0] < numbers[1]:
numbers.remove(numbers[1])
else:
numbers.remove(numbers[0])
return minimum(numbers) | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
40,532 | def minimum(numbers):
if len(numbers) == 1:
return numbers[0]
if numbers[0] < numbers[1]:
numbers.remove(numbers[1])
else:
numbers.remove(numbers[0])
return minimum(numbers) | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
6,485 | def maximum(collection, itera=0, mini=None):
if itera == 0:
mini = collection[0]
if len(collection) == itera:
return mini
if mini < collection[itera]:
mini = collection[itera]
return maximum(collection, itera + 1, mini)
else:
return maximum(collection, itera + 1, mini) | 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 | e36ebdf2-7cd7-440f-af8b-386d6e2d920f | 2,016 |
32,175 | def maximum(collection, itera=0, mini=None):
if itera == 0:
mini = collection[0]
if len(collection) == itera:
return mini
if mini < collection[itera]:
mini = collection[itera]
return maximum(collection, itera + 1, mini)
else:
return maximum(collection, itera + 1, mini) | 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 | e36ebdf2-7cd7-440f-af8b-386d6e2d920f | 2,016 |
2,697 | def maximum(a):
a = sorted(a)
return a[-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 | 8d8fa15f-3f0d-4a69-849b-9b7da96123cd | 2,016 |
19,608 | def maximum(a):
a = sorted(a)
return a[-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 | 8d8fa15f-3f0d-4a69-849b-9b7da96123cd | 2,016 |
14,995 | def maximum(l):
return sorted(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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
5,712 | def maximum(l):
return sorted(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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
9,933 | def count_letters(s):
return len(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 | true | 8d8fa15f-3f0d-4a69-849b-9b7da96123cd | 2,016 |
39,014 | def count_letters(s):
return len(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 | true | 8d8fa15f-3f0d-4a69-849b-9b7da96123cd | 2,016 |
10,882 | def count_letters(s):
return len(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 | true | 8d8fa15f-3f0d-4a69-849b-9b7da96123cd | 2,016 |
25,160 | def maximum(numbers):
if len(numbers) == 1:
return numbers[0]
if numbers[0] > numbers[1]:
numbers.remove(numbers[1])
else:
numbers.remove(numbers[0])
return maximum(numbers) | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
30,747 | def maximum(numbers):
if len(numbers) == 1:
return numbers[0]
if numbers[0] > numbers[1]:
numbers.remove(numbers[1])
else:
numbers.remove(numbers[0])
return maximum(numbers) | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
37,335 | def minimum(m=[]):
i = 0
a = m[i]
while i < len(m):
if a > m[i]:
a = m[i]
i += 1
return 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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
7,058 | def minimum(m=[]):
i = 0
a = m[i]
while i < len(m):
if a > m[i]:
a = m[i]
i += 1
return 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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
24,387 | def maximum(m=[]):
i = 0
a = m[i]
while i < len(m):
if a < m[i]:
a = m[i]
i += 1
return a | 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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
24,118 | def maximum(m=[]):
i = 0
a = m[i]
while i < len(m):
if a < m[i]:
a = m[i]
i += 1
return a | 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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
39,604 | def maximum(m=[]):
i = 0
a = m[i]
while i < len(m):
if a < m[i]:
a = m[i]
i += 1
return a | 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 | 93426de2-87e4-4c00-9910-de51627bd576 | 2,016 |
23,927 | def reverse_list(a):
i = 0
while i < len(a) / 2:
tmp = a[i]
a[i] = a[len(a) - 1 - i]
a[len(a) - 1 - i] = tmp
i += 1
return a | 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 | 8d8fa15f-3f0d-4a69-849b-9b7da96123cd | 2,016 |
10,457 | def reverse_list(a):
i = 0
while i < len(a) / 2:
tmp = a[i]
a[i] = a[len(a) - 1 - i]
a[len(a) - 1 - i] = tmp
i += 1
return a | 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 | 8d8fa15f-3f0d-4a69-849b-9b7da96123cd | 2,016 |
40,270 | def count_letters(inputed, counter=0):
if inputed[:-1] == '':
return counter
if counter == 0:
counter += 1
return count_letters(inputed[:-1], counter + 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 | e36ebdf2-7cd7-440f-af8b-386d6e2d920f | 2,016 |
26,074 | def count_letters(inputed, counter=0):
if inputed[:-1] == '':
return counter
if counter == 0:
counter += 1
return count_letters(inputed[:-1], counter + 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 | e36ebdf2-7cd7-440f-af8b-386d6e2d920f | 2,016 |
3,606 | def power(a, b):
return a ** b | 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
36,532 | def minimum(a):
return min(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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
26,939 | def count_letters(s):
i = 0
for c in s:
i += 1
return i | 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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
5,648 | def reverse_list(input_list, workinglist=[], new=True):
if new:
workinglist = []
if len(input_list) == 0:
return workinglist
else:
workinglist.append(input_list[-1])
return reverse_list(input_list[:-1], workinglist, False) | 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 | e36ebdf2-7cd7-440f-af8b-386d6e2d920f | 2,016 |
7,991 | def reverse_list(input_list, workinglist=[], new=True):
if new:
workinglist = []
if len(input_list) == 0:
return workinglist
else:
workinglist.append(input_list[-1])
return reverse_list(input_list[:-1], workinglist, False) | 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 | e36ebdf2-7cd7-440f-af8b-386d6e2d920f | 2,016 |
5,881 | def reverse_list(input_list, workinglist=[], new=True):
if new:
workinglist = []
if len(input_list) == 0:
return workinglist
else:
workinglist.append(input_list[-1])
return reverse_list(input_list[:-1], workinglist, False) | 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 | e36ebdf2-7cd7-440f-af8b-386d6e2d920f | 2,016 |
8,561 | def power(x, n):
if n == 0:
return 1
elif n == 1:
return x
else:
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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
14,073 | def power(x, n):
if n == 0:
return 1
elif n == 1:
return x
else:
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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
30,512 | def count_letters(s):
i = 0
for c in s:
i += 1
return i | 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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
14,483 | def count_letters(s):
i = 0
for c in s:
i += 1
return i | 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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
28,813 | def reverse_list(a):
m = a[::-1]
return m | 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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
7,888 | def reverse_list(a):
m = a[::-1]
return m | 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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
23,563 | def fibonacci(n):
if n <= 1:
return n
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 | true | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
36,873 | def count_letters(s):
if s == '':
return 0
count = 0
for c in s:
count += 1
return count | 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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
4,051 | def count_letters(s):
if s == '':
return 0
count = 0
for c in s:
count += 1
return count | 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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
13,982 | 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 | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
41,406 | 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 | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
30,765 | def minimum(a):
if len(a) == 1:
return a
else:
if a[0] < a[1]:
del a[1]
else:
del 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 | false | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
41,914 | def minimum(a):
if len(a) == 1:
return a[0]
else:
if a[0] < a[1]:
del a[1]
else:
del 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
40,529 | def minimum(a):
if len(a) == 1:
return a[0]
else:
if a[0] < a[1]:
del a[1]
else:
del 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
23,266 | def fibonacci(n):
if n == 1 or n == 0:
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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
23,795 | def fibonacci(n):
if n == 1 or n == 0:
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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
10,630 | def reverse_list(l, s=None):
if s == None:
s = []
if l == []:
return s
else:
s.append(l[-1])
l.remove(l[-1])
return reverse_list(l, s) | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
12,415 | def reverse_list(l, s=None):
if s == None:
s = []
if l == []:
return s
else:
s.append(l[-1])
l.remove(l[-1])
return reverse_list(l, s) | 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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
36,968 | def maximum(a):
if len(a) == 1:
return a[0]
else:
if a[0] > a[1]:
del a[1]
else:
del a[0]
return maximum(a) | 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
13,271 | def maximum(a):
if len(a) == 1:
return a[0]
else:
if a[0] > a[1]:
del a[1]
else:
del a[0]
return maximum(a) | 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
1,206 | 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
31,838 | 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
37,030 | def fibonacci(n):
if n == 0:
return 1
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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
1,110 | def fibonacci(n):
if n == 0:
return 1
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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
4,844 | def fibonacci(n):
if n == 0:
return 1
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 | 3d19e1db-d496-420c-b077-41631364e4f7 | 2,016 |
41,061 | 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 | 8d8fa15f-3f0d-4a69-849b-9b7da96123cd | 2,016 |
18,185 | 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 | 8d8fa15f-3f0d-4a69-849b-9b7da96123cd | 2,016 |
3,582 | def reverse_list(l):
if l == []:
return []
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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
29,837 | def reverse_list(l):
if l == []:
return []
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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
14,592 | 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 | false | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
18,900 | 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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
34,510 | def reverse_list(a):
return reverse_list(a[1:]) + a[0] | 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
38,022 | 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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
37,463 | 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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
12,191 | def fibonacci(n):
if n <= 1:
return 1
return 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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
28,171 | def fibonacci(n):
if n <= 1:
return 1
return 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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
36,132 | def reverse_list(a):
return reverse_list(a[1:]) + [a[0]] | 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
37,258 | 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 | 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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
26,602 | 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 | 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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
30,451 | 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 | 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 | f98e9d61-9e86-4fed-86db-3cf718c5962d | 2,016 |
6,594 | 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 | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
21,253 | 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 | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
15,163 | 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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
22,130 | 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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
22,482 | def reverse_list(l, i=None):
if i is None:
i = len(l) - 1
if i > 0:
return reverse_list(l[1:] + [l[0]], i - 1)
else:
return 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
1,586 | def reverse_list(l, i=None):
if i is None:
i = len(l) - 1
if i >= 0:
return reverse_list(l[1:] + [l[0]], i - 1)
else:
return 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
36,074 | def reverse_list(l, i=None):
if i is None:
i = len(l)
if i > 0:
return reverse_list(l[1:] + [l[0]], i - 1)
else:
return 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
13,396 | def reverse_list(l, i=None):
if i is None:
i = len(l) // 2
if i > 0:
return reverse_list(l[1:] + [l[0]], i - 1)
else:
return 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
10,936 | def reverse_list(l, i=None):
if i is None:
i = len(l) // 2
if i >= 0:
return reverse_list(l[1:] + [l[0]], i - 1)
else:
return 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
23,727 | 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 | false | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
3,972 | def selectionsort(A):
i = 0
while i < len(A) - 1:
p = i
j = i + 1
while j < len(A):
if A[j] < A[p]:
p = j
j += 1
tmp = A[p]
A[p] = A[i]
A[i] = tmp
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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
41,460 | def selectionsort(A):
i = 0
while i < len(A) - 1:
p = i
j = i + 1
while j < len(A):
if A[j] < A[p]:
p = j
j += 1
tmp = A[p]
A[p] = A[i]
A[i] = tmp
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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
25,531 | def selectionsort(A):
i = 0
while i < len(A) - 1:
p = i
j = i + 1
while j < len(A):
if A[j] < A[p]:
p = j
j += 1
tmp = A[p]
A[p] = A[i]
A[i] = tmp
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 | 07676427-a705-4cb7-a5ef-6a1c3c67c950 | 2,016 |
22,881 | 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 | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
11,961 | 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 | 45fe5d71-35bd-4b87-b28c-71b204939543 | 2,016 |
6,971 | def power(m, n):
if n == 0:
return 1
elif n == 1:
return m
else:
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 | ac1dec5e-a5eb-4183-ba72-3b639e82db3c | 2,016 |
9,091 | def power(m, n):
if n == 0:
return 1
elif n == 1:
return m
else:
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 | ac1dec5e-a5eb-4183-ba72-3b639e82db3c | 2,016 |
22,971 | def reverse_list(l, i=0):
if i < len(l) // 2:
l[i], l[-i - 1] = l[-i - 1], l[i]
return reverse_list(l, i + 1)
else:
return 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
6,634 | def reverse_list(l, i=0):
if i < len(l) // 2:
l[i], l[-i - 1] = l[-i - 1], l[i]
return reverse_list(l, i + 1)
else:
return 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 | 9a05c20e-2fde-40c1-948b-649e25b30e6e | 2,016 |
2,432 | def lowest(first, rest):
if len(rest) == 0:
return first
if first > rest[0] or first < 0:
return lowest(rest[0], rest[1:])
else:
return lowest(first, rest[1:])
def minimum(l):
def lowest(first, rest):
if len(rest) == 0:
return first
if first > rest[0] or first < 0:
return lowest(rest[0], rest[1:])
else:
return lowest(first, rest[1:])
return lowest(l[0], 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 | ac1dec5e-a5eb-4183-ba72-3b639e82db3c | 2,016 |
33,596 | def lowest(first, rest):
if len(rest) == 0:
return first
if first > rest[0] or first <= 0:
return lowest(rest[0], rest[1:])
else:
return lowest(first, rest[1:])
def minimum(l):
def lowest(first, rest):
if len(rest) == 0:
return first
if first > rest[0] or first <= 0:
return lowest(rest[0], rest[1:])
else:
return lowest(first, rest[1:])
return lowest(l[0], 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 | ac1dec5e-a5eb-4183-ba72-3b639e82db3c | 2,016 |
9,523 | def lowest(first, rest):
if len(rest) == 0:
return first
if first > rest[0] or first < 0:
return lowest(rest[0], rest[1:])
else:
return lowest(first, rest[1:])
def minimum(l=None):
if l == None:
l = []
def lowest(first, rest):
if len(rest) == 0:
return first
if first > rest[0] or first < 0:
return lowest(rest[0], rest[1:])
else:
return lowest(first, rest[1:])
return lowest(l[0], 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 | ac1dec5e-a5eb-4183-ba72-3b639e82db3c | 2,016 |
17,011 | def lowest(first, rest):
if len(rest) == 0:
return first
elif first > rest[0] or first < 0:
return lowest(rest[0], rest[1:])
else:
return lowest(first, rest[1:])
def minimum(l=None):
if l == None:
l = []
def lowest(first, rest):
if len(rest) == 0:
return first
elif first > rest[0] or first < 0:
return lowest(rest[0], rest[1:])
else:
return lowest(first, rest[1:])
return lowest(l[0], 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 | ac1dec5e-a5eb-4183-ba72-3b639e82db3c | 2,016 |
33,215 | def selectionsort(a):
i = 0
p = 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 | 66e06699-d10a-47f1-a343-55edd72e95d2 | 2,016 |
428 | def selectionsort(a):
i = 0
p = 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 | 66e06699-d10a-47f1-a343-55edd72e95d2 | 2,016 |
17,206 | def minimum(l, current_min=None):
if not l:
return current_min
first = l.pop()
if current_min == None or first < current_min:
return minimum(l, first)
return minimum(l, current_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 | ac1dec5e-a5eb-4183-ba72-3b639e82db3c | 2,016 |
40,564 | def minimum(l, current_min=None):
if not l:
return current_min
first = l.pop()
if current_min == None or first < current_min:
return minimum(l, first)
return minimum(l, current_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 | ac1dec5e-a5eb-4183-ba72-3b639e82db3c | 2,016 |
42,232 | def maximum(l, current_max=None):
if not l:
return current_max
first = l.pop()
if current_max == None or first > current_max:
return maximum(l, first)
return maximum(l, current_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 | ac1dec5e-a5eb-4183-ba72-3b639e82db3c | 2,016 |
27,397 | def maximum(l, current_max=None):
if not l:
return current_max
first = l.pop()
if current_max == None or first > current_max:
return maximum(l, first)
return maximum(l, current_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 | ac1dec5e-a5eb-4183-ba72-3b639e82db3c | 2,016 |
33,577 | 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 | 75a32f49-710d-463f-8fee-0ae9b91a3034 | 2,016 |
14,266 | 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 | 75a32f49-710d-463f-8fee-0ae9b91a3034 | 2,016 |
31,602 | 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 | 66e06699-d10a-47f1-a343-55edd72e95d2 | 2,016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.