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
14,494
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
31,571
def count_letters(s): n = 0 if not s: return 0 else: n += 1 return n + 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
652b3384-e559-46c5-81db-1bf2117db63b
2,016
13,633
def count_letters(s): n = 0 if not s: return 0 else: n += 1 return n + 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
652b3384-e559-46c5-81db-1bf2117db63b
2,016
26,373
def reverse_list(a): if len(a) == 0: return [] return [a[-1]] + reverse_list(a[:-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
652b3384-e559-46c5-81db-1bf2117db63b
2,016
37,754
def reverse_list(a): if len(a) == 0: return [] return [a[-1]] + reverse_list(a[:-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
652b3384-e559-46c5-81db-1bf2117db63b
2,016
2,407
def fibonacci(n): if n == 1 or n == 0: 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
652b3384-e559-46c5-81db-1bf2117db63b
2,016
31,639
def fibonacci(n): if n == 1 or n == 0: 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
652b3384-e559-46c5-81db-1bf2117db63b
2,016
1,887
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
652b3384-e559-46c5-81db-1bf2117db63b
2,016
11,293
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
652b3384-e559-46c5-81db-1bf2117db63b
2,016
20,826
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 += 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
652b3384-e559-46c5-81db-1bf2117db63b
2,016
16,497
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 += 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
652b3384-e559-46c5-81db-1bf2117db63b
2,016
30,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 += 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
652b3384-e559-46c5-81db-1bf2117db63b
2,016
9,474
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
6668ebd6-a850-4666-b8cc-5c934a67601a
2,016
11,116
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
6668ebd6-a850-4666-b8cc-5c934a67601a
2,016
35,264
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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
19,769
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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
3,087
def reverse_list(l): if len(l) == 0: return [] else: return [l[-1]] + reverse_list(l[:-1])
reverse_recur
reverse_list
Recursively reverse a list of elements.
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
true
6668ebd6-a850-4666-b8cc-5c934a67601a
2,016
28,105
def reverse_list(l): if len(l) == 0: return [] else: return [l[-1]] + reverse_list(l[:-1])
reverse_recur
reverse_list
Recursively reverse a list of elements.
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
true
6668ebd6-a850-4666-b8cc-5c934a67601a
2,016
28,610
def minimum(l): return min(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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
33,618
def minimum(l): return min(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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
21,966
def maximum(l): return max(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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
10,667
def maximum(l): return max(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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
5,442
def count_letters(a): return len(a)
count_letters
count_letters
Return the number of lettres in a string.
assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13
true
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
3,860
def count_letters(a): return len(a)
count_letters
count_letters
Return the number of lettres in a string.
assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13
true
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
11,712
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
6668ebd6-a850-4666-b8cc-5c934a67601a
2,016
7,081
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
6668ebd6-a850-4666-b8cc-5c934a67601a
2,016
11,437
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
6668ebd6-a850-4666-b8cc-5c934a67601a
2,016
28,189
def reverse_list(l): return 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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
42,375
def reverse_list(l): return 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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
18,783
def fibonacci(n): if n == 0: return 1 elif n == 1: return 1 return fibonacci(n - 1) + fibonacci(n - 2)
fibonacci_recur
fibonacci
Recursively compute the value of the fibonacci series at position n.
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
false
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
19,921
def fibonacci(n): if n == 0: return 1 elif n == 1: return 1 return fibonacci(n - 1) + fibonacci(n - 2)
fibonacci_recur
fibonacci
Recursively compute the value of the fibonacci series at position n.
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
false
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
31,133
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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
10,654
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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
662
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 += 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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
20,231
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 += 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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
35,830
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 += 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
fa7e9f17-de07-4868-ab69-667438d7becd
2,016
11,559
def fibonacci(s): if s == 0: return 0 if s in (1, 2): return 1 return fibonacci(s - 1) + fibonacci(s - 2)
fibonacci_recur
fibonacci
Recursively compute the value of the fibonacci series at position n.
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
true
262b3841-5158-4b0c-be99-57281e73f267
2,016
14,658
def fibonacci(s): if s == 0: return 0 if s in (0, 1): return 1 return fibonacci(s - 1) + fibonacci(s - 2)
fibonacci_recur
fibonacci
Recursively compute the value of the fibonacci series at position n.
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
true
262b3841-5158-4b0c-be99-57281e73f267
2,016
21,047
def fibonacci(s): if s in (0, 1): return 1 return fibonacci(s - 1) + fibonacci(s - 2)
fibonacci_recur
fibonacci
Recursively compute the value of the fibonacci series at position n.
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
false
262b3841-5158-4b0c-be99-57281e73f267
2,016
15,519
def fibonacci(s): if s in (0, 1): return 1 return fibonacci(s - 1) + fibonacci(s - 2)
fibonacci_recur
fibonacci
Recursively compute the value of the fibonacci series at position n.
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
false
262b3841-5158-4b0c-be99-57281e73f267
2,016
26,812
def power(n, p): if p == 0: return 1 return n ** p
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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
33,917
def power(n, p): if p == 0: return 1 return n ** p
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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
10,842
def quicksort(array, b, c): less = [] greater = [] equal = [] if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] greater = [i for i in array if i > piv] greater = [i for i in array if i == piv] array = less + greater + equal
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
10,702
def quicksort(array, b, c): less = [] greater = [] equal = [] if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] greater = [i for i in array if i > piv] greater = [i for i in array if i == piv] array = greater + equal + less
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
10,273
def quicksort(array, b, c): less = [] greater = [] equal = [] if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] greater = [i for i in array if i > piv] less = [i for i in array if i == piv] quicksort(greater, b, c) quicksort(less, b, c) array = greater + equal + less
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
1,851
def quicksort(array, b, c): less = [] greater = [] equal = [] if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] greater = [i for i in array if i > piv] equal = [i for i in array if i == piv] quicksort(greater, b, c) quicksort(less, b, c) array = greater + equal + less
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
355
def quicksort(array, b, c): less = [] greater = [] equal = [] if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] print(less) greater = [i for i in array if i > piv] equal = [i for i in array if i == piv] quicksort(greater, b, c) quicksort(less, b, c) array = greater + equal + less
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
17,609
def _quicksort(array): less = [] greater = [] equal = [] if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] greater = [i for i in array if i > piv] equal = [i for i in array if i == piv] return quicksort(greater, b, c) + equal + quicksort(less, b, c) def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
16,028
def _quicksort(array): less = [] greater = [] equal = [] if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] greater = [i for i in array if i > piv] equal = [i for i in array if i == piv] return quicksort(greater) + equal + quicksort(less) def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
27,986
def _quicksort(array): less = [] greater = [] equal = [] if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] greater = [i for i in array if i > piv] equal = [i for i in array if i == piv] return _quicksort(greater) + equal + _quicksort(less) def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
20,683
def _quicksort(array): less = [] greater = [] equal = [] if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] greater = [i for i in array if i > piv] equal = [i for i in array if i == piv] return _quicksort(greater) + equal + _quicksort(less) else: return [] def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
15,725
def _quicksort(array): less = [] greater = [] print(greater) equal = [] if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] greater = [i for i in array if i > piv] equal = [i for i in array if i == piv] return _quicksort(greater) + equal + _quicksort(less) else: return [] def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
41,673
def minimum(l): l = sorted(minimum(l)) 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
false
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
38,503
def _quicksort(array): less = [] greater = [] print(greater) equal = [] if len(array) > 0: piv = array[0] print(piv) less = [i for i in array if i < piv] greater = [i for i in array if i > piv] equal = [i for i in array if i == piv] return _quicksort(greater) + equal + _quicksort(less) else: return [] def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
11,120
def minimum(l): l = sorted(minimum(l)) 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
false
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
20,159
def _quicksort(array): if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] greater = [i for i in array if i > piv] equal = [i for i in array if i == piv] return _quicksort(greater) + equal + _quicksort(less) else: return [] def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
30,297
def minimum(l): if len(l) == 1: return l[0] elif l[0] > l[1]: l.remove(l[0]) else: l.remove(l[1]) 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
35,146
def minimum(l): if len(l) == 1: return l[0] elif l[0] > l[1]: l.remove(l[0]) else: l.remove(l[1]) 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
8,940
def _quicksort(array): if len(array) > 0: piv = array[0] less = [i for i in array if i < piv] print(less) greater = [i for i in array if i >= piv] return _quicksort(greater) + _quicksort(less) else: return [] def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
19,086
def maximum(l): if len(l) == 1: return l[0] elif l[0] < l[1]: l.remove(l[0]) else: l.remove(l[1]) return minimum(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
false
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
25,763
def _quicksort(array): if len(array) > 0: piv = array[0] less = [] greater = [] for i in array: if i < piv: less += i else: greater += i return _quicksort(greater) + _quicksort(less) else: return [] def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
18,668
def _quicksort(array): if len(array) > 0: piv = array[0] less = [] greater = [] for i in array: if i < piv: less = less + i else: greater = greater + i return _quicksort(greater) + _quicksort(less) else: return [] def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
31,808
def _quicksort(array): if len(array) > 0: piv = array[0] less = [] greater = [] for i in array: if i < piv: less = less + [i] else: greater = greater + [i] return _quicksort(greater) + _quicksort(less) else: return [] def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
5,193
def maximum(l): if len(l) == 1: return l[0] elif l[0] < l[1]: l.remove(l[0]) else: l.remove(l[1]) 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
24,824
def maximum(l): if len(l) == 1: return l[0] elif l[0] < l[1]: l.remove(l[0]) else: l.remove(l[1]) 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
1,530
def _quicksort(array): if len(array) > 0: piv = array[0] less = [] greater = [] for i in array: if i < piv: less = less + [i] else: greater = greater + [i] print(less) return _quicksort(greater) + _quicksort(less) else: return [] def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
19,961
def _quicksort(array): if array <= 1: return array else: piv = array[0] less = [] greater = [] for i in array: if i < piv: less = less + [i] else: greater = greater + [i] return _quicksort(greater) + _quicksort(less) def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
32,564
def _quicksort(array): if len(array) <= 1: return array else: piv = array[0] less = [] greater = [] for i in array: if i < piv: less = less + [i] else: greater = greater + [i] return _quicksort(greater) + _quicksort(less) def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
1,832
def count_letters(l): return len(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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
30,473
def count_letters(l): return len(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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
26,108
def _quicksort(array): if len(array) <= 1: return array else: piv = array[0] less = [] greater = [] for i in array: if i < piv: less = less + [i] else: greater = greater + [i] less = _quicksort(less) more = _quicksort(more) return less + more def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
36,541
def _quicksort(array): if len(array) <= 1: return array else: piv = array[0] less = [] greater = [] for i in array: if i < piv: less = less + [i] else: greater = greater + [i] less = _quicksort(less) greater = _quicksort(greater) return less + greater def quicksort(array, a, b): array = _quicksort(array)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
10,019
def _quicksort(array): if not array: return [] else: pivot = array[0] less = [x for x in array if x < pivot] more = [x for x in array[1:] if x >= pivot] return quicksort(less) + [pivot] + quicksort(more) def quicksort(l, a, b): def _quicksort(array): if not array: return [] else: pivot = array[0] less = [x for x in array if x < pivot] more = [x for x in array[1:] if x >= pivot] return quicksort(less) + [pivot] + quicksort(more) l = _quicksort(l)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
19,887
def power(m, n): 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
4986b17f-a671-4d40-a5ca-1c65fd498cbf
2,016
10,292
def power(m, n): 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
4986b17f-a671-4d40-a5ca-1c65fd498cbf
2,016
35,990
def power(m, n): 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
4986b17f-a671-4d40-a5ca-1c65fd498cbf
2,016
41,513
def _quicksort(array): if not array: return [] else: pivot = array[0] less = [x for x in array if x < pivot] more = [x for x in array[1:] if x >= pivot] return _quicksort(less) + [pivot] + _quicksort(more) def quicksort(l, a, b): def _quicksort(array): if not array: return [] else: pivot = array[0] less = [x for x in array if x < pivot] more = [x for x in array[1:] if x >= pivot] return _quicksort(less) + [pivot] + _quicksort(more) l = _quicksort(l)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
25,271
def count_letters(l): return len(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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
12,265
def count_letters(l): return len(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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
2,996
def _quicksort(array): if not array: return [] else: pivot = array[0] less = [x for x in array if x < pivot] more = [x for x in array[1:] if x >= pivot] return _quicksort(less) + [pivot] + _quicksort(more) def quicksort(l, a, b): def _quicksort(array): if not array: return [] else: pivot = array[0] less = [x for x in array if x < pivot] more = [x for x in array[1:] if x >= pivot] return _quicksort(less) + [pivot] + _quicksort(more) print(_quicksort(l))
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
34,905
def reverse_list(l): return 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
35,305
def reverse_list(l): return 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
9,666
def _quicksort(array): if not array: return [] else: pivot = array[0] less = [x for x in array if x < pivot] more = [x for x in array[1:] if x >= pivot] return _quicksort(less) + [pivot] + _quicksort(more) def quicksort(l, a, b): def _quicksort(array): if not array: return [] else: pivot = array[0] less = [x for x in array if x < pivot] more = [x for x in array[1:] if x >= pivot] return _quicksort(less) + [pivot] + _quicksort(more) l[:] = _quicksort(l)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
37,232
def _quicksort(array): if not array: return [] else: pivot = array[0] less = [x for x in array if x < pivot] more = [x for x in array[1:] if x >= pivot] return _quicksort(less) + [pivot] + _quicksort(more) def quicksort(l, a, b): def _quicksort(array): if not array: return [] else: pivot = array[0] less = [x for x in array if x < pivot] more = [x for x in array[1:] if x >= pivot] return _quicksort(less) + [pivot] + _quicksort(more) l[:] = _quicksort(l)
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
22,968
def fibonacci(n): if n == 0 or 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
21,226
def fibonacci(n): if n == 0 or 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
38,308
def chksorted(a): for i in range(len(a) - 1): if not a[i] < a[i + 1]: return False return True def selectionsort(array): def chksorted(a): for i in range(len(a) - 1): if not a[i] < a[i + 1]: return False return True m = min(array) mi = array.index(m) if not chksorted(array): f = array[0] array[0] = m array[mi] = f
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
262b3841-5158-4b0c-be99-57281e73f267
2,016
11,597
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): 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 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
16,459
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): 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 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
29,462
def selectionsort(array): for i in range(len(arr)): for j in range(i, len(arr)): if arr[i] > arr[j]: arr[i], arr[j] = arr[j], arr[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
false
262b3841-5158-4b0c-be99-57281e73f267
2,016
27,477
def selectionsort(array): for i in range(len(arr)): for j in range(i, len(arr)): if arr[i] > arr[j]: arr[i], arr[j] = arr[j], arr[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
false
262b3841-5158-4b0c-be99-57281e73f267
2,016
18,874
def selectionsort(array): for i in range(len(array)): for j in range(i, len(array)): if array[i] > array[j]: array[i], array[j] = array[j], array[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
262b3841-5158-4b0c-be99-57281e73f267
2,016
9,846
def selectionsort(array): for i in range(len(array)): for j in range(i, len(array)): if array[i] > array[j]: array[i], array[j] = array[j], array[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
262b3841-5158-4b0c-be99-57281e73f267
2,016
29,429
def selectionsort(array): for i in range(len(array)): for j in range(i, len(array)): if array[i] > array[j]: array[i], array[j] = array[j], array[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
262b3841-5158-4b0c-be99-57281e73f267
2,016
22,963
def selectionsort(n): i = 0 while i < len(n): p = i j = i + 1 while j < len(n): if n[j] < n[i]: p = j j += 1 tmp = n[p] n[p] = n[i] n[i] = temp 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
42,255
def selectionsort(n): i = 0 while i < len(n): p = i j = i + 1 while j < len(n): if n[j] < n[i]: p = j j += 1 tmp = n[p] n[p] = n[i] n[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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
28,243
def selectionsort(A): i = 0 while i < len(A): p = i j = i + 1 while j < len(A): if A[j] < A[i]: 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
1,654
def selectionsort(a): i = 0 while i < len(a): p = i j = i + 1 while j < len(a): if a[j] < a[i]: 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
35,890
def selectionsort(A): i = 0 while i < len(A): p = i j = i + 1 while j < len(A): if A[j] < A[i]: p = j j += 1 tmp = A[p] A[p] = A[i] A[i] = tmp i = +1 return selectionsort(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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016
34,813
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 += 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
2eb2f93d-3491-4b0b-bad9-894c90595058
2,016