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
16,526
def minimum(a): i = 1 mini = a[0] while i < len(a): if mini < a[i]: mini = mini elif mini > a[i]: mini = a[i] i += 1 return mini
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
4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7
2,016
40,154
def minimum(a): i = 1 mini = a[0] while i < len(a): if mini < a[i]: mini = mini elif mini > a[i]: mini = a[i] i += 1 return mini
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
4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7
2,016
38,277
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
13,028
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
817
def maximum(a): i = 1 mini = a[0] while i < len(a): if mini > a[i]: mini = mini elif mini < a[i]: mini = a[i] i += 1 return 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
4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7
2,016
4,827
def maximum(a): i = 1 mini = a[0] while i < len(a): if mini > a[i]: mini = mini elif mini < a[i]: mini = a[i] i += 1 return 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
4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7
2,016
37,918
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
31,259
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
26,715
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
42,425
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
29,542
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
1,591
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
39,517
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
5,796
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
12,283
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
40,669
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
99a8a900-efcf-4a9e-86ba-fdd0df4312d3
2,016
19,859
def count_letters(a): al = list(a) tot = 0 for c in al: tot += +1 return tot
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
4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7
2,016
26,446
def count_letters(a): al = list(a) tot = 0 for c in al: tot += +1 return tot
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
4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7
2,016
38,881
def reverse_list(a): return 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
4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7
2,016
40,299
def reverse_list(a): return 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
4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7
2,016
3,435
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
6cbd9686-8a3c-4d12-8a1a-70c661732027
2,016
8,307
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
6cbd9686-8a3c-4d12-8a1a-70c661732027
2,016
32,999
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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
38,754
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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
28,900
def maximum(a): if len(a) == 1: return a[0] if a[0] > a[1]: a.remove(a[1]) return maximum(a) else: a.remove(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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
16,773
def maximum(a): if len(a) == 1: return a[0] if a[0] > a[1]: a.remove(a[1]) return maximum(a) else: a.remove(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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
15,473
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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
24,307
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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
1,896
def minimum(a): if len(a) == 1: return a[0] if a[0] < a[1]: a.remove(a[1]) return minimum(a) else: a.remove(a[0]) return minimum(a)
minimum
minimum
Return the minimum element in a list of numbers.
assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45
true
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
20,028
def minimum(a): if len(a) == 1: return a[0] if a[0] < a[1]: a.remove(a[1]) return minimum(a) else: a.remove(a[0]) return minimum(a)
minimum
minimum
Return the minimum element in a list of numbers.
assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45
true
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
23,224
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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
38,649
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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
10,469
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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
21,326
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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
6,928
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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
28,374
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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
19,047
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
6a42703e-da42-4824-8b83-b6f291ad71be
2,016
29,769
def minimum(a): if len(a) == 1: return a[0] if a[0] < a[1]: a.remove(a[1]) return minimum(a) else: a.remove(a[0]) return minimum(a)
minimum
minimum
Return the minimum element in a list of numbers.
assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45
true
6cbd9686-8a3c-4d12-8a1a-70c661732027
2,016
13,238
def minimum(a): if len(a) == 1: return a[0] if a[0] < a[1]: a.remove(a[1]) return minimum(a) else: a.remove(a[0]) return minimum(a)
minimum
minimum
Return the minimum element in a list of numbers.
assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45
true
6cbd9686-8a3c-4d12-8a1a-70c661732027
2,016
25,915
def maximum(a): if len(a) == 1: return a[0] if a[0] > a[1]: a.remove(a[1]) return maximum(a) else: a.remove(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
6cbd9686-8a3c-4d12-8a1a-70c661732027
2,016
31,205
def maximum(a): if len(a) == 1: return a[0] if a[0] > a[1]: a.remove(a[1]) return maximum(a) else: a.remove(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
6cbd9686-8a3c-4d12-8a1a-70c661732027
2,016
16,828
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
6cbd9686-8a3c-4d12-8a1a-70c661732027
2,016
10,208
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
6cbd9686-8a3c-4d12-8a1a-70c661732027
2,016
1,460
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
6cbd9686-8a3c-4d12-8a1a-70c661732027
2,016
28,696
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
6cbd9686-8a3c-4d12-8a1a-70c661732027
2,016
31,747
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
6cbd9686-8a3c-4d12-8a1a-70c661732027
2,016
23,133
def minimum(line=[]): m = line[0] for i in line: if i < m: m = i return m
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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
10,412
def minimum(line=[]): m = line[0] for i in line: if i < m: m = i return m
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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
38,782
def maximum(line=[]): m = line[0] for i in line: if i > m: m = i return m
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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
27,715
def maximum(line=[]): m = line[0] for i in line: if i > m: m = i return m
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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
34,375
def maximum(line=[]): m = line[0] for i in line: if i > m: m = i return m
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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
19,293
def reverse_list(a=[]): a.reverse() 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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
40,374
def reverse_list(a=[]): a.reverse() 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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
7,297
def fibonacci(n): if n == 0: return 1 elif 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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
2,128
def fibonacci(n): if n == 0: return 1 elif 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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
38,332
def selectionsort(a): for i in range(len(a)): for j in range(i + 1, len(a)): if a[i] > a[j]: a[i], a[j] = a[j], a[i] 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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
29,396
def selectionsort(a): for i in range(len(a)): for j in range(i + 1, len(a)): if a[i] > a[j]: a[i], a[j] = a[j], a[i] 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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
29,277
def selectionsort(a): for i in range(len(a)): for j in range(i + 1, len(a)): if a[i] > a[j]: a[i], a[j] = a[j], a[i] 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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
31,648
def quicksort(a): less = [] equal = [] greater = [] if len(a) > 1: pivot = a[0] for x in a: if x < pivot: less.append(x) if x == pivot: equal.append(x) if x > pivot: greater.append(x) return sort(less) + equal + sort(greater) else: return a
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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
38,176
def quicksort(a): less = [] equal = [] greater = [] if len(a) > 1: pivot = a[0] for x in a: if x < pivot: less.append(x) if x == pivot: equal.append(x) if x > pivot: greater.append(x) return sort(less) + equal + sort(greater) else: return a
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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
21,469
def quicksort(a): less = [] equal = [] greater = [] if len(a) > 1: pivot = a[0] for x in a: if x < pivot: less.append(x) if x == pivot: equal.append(x) if x > pivot: greater.append(x) return sort(less) + equal + sort(greater) else: return a
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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
35,036
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) return A
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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
33,334
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) return A
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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
6,516
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) return A
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
f463a026-5eb4-4a39-a858-3a798215a4ee
2,016
26,788
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
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
41,328
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
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
40,892
def minimum(a): if len(a) == 1: return a[0] if a[0] < a[1]: a.remove(a[1]) else: a.remove(a[0]) return minimum(a)
minimum
minimum
Return the minimum element in a list of numbers.
assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45
true
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
25,346
def minimum(a): if len(a) == 1: return a[0] if a[0] < a[1]: a.remove(a[1]) else: a.remove(a[0]) return minimum(a)
minimum
minimum
Return the minimum element in a list of numbers.
assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45
true
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
17,606
def maximum(a): if len(a) == 1: return a[0] if a[0] > a[1]: a.remove(a[1]) else: a.remove(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
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
30,343
def maximum(a): if len(a) == 1: return a[0] if a[0] > a[1]: a.remove(a[1]) else: a.remove(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
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
4,110
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
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
10,611
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
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
26,937
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
8d8fa15f-3f0d-4a69-849b-9b7da96123cd
2,016
25,247
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
8d8fa15f-3f0d-4a69-849b-9b7da96123cd
2,016
32,721
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
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
36,668
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
66e06699-d10a-47f1-a343-55edd72e95d2
2,016
5,720
def power(base, power2): if base == 0: return 'invalid' if power2 == 0: return 1 elif power2 == 1: return base else: return base * power(base, power2 - 1)
power
power
Raise m to the power of n.
assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1
false
e36ebdf2-7cd7-440f-af8b-386d6e2d920f
2,016
33,161
def power(base, power2): if base == 0: return 'invalid' if power2 == 0: return 1 elif power2 == 1: return base else: return base * power(base, power2 - 1)
power
power
Raise m to the power of n.
assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1
false
e36ebdf2-7cd7-440f-af8b-386d6e2d920f
2,016
15,862
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
f98e9d61-9e86-4fed-86db-3cf718c5962d
2,016
22,128
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
f98e9d61-9e86-4fed-86db-3cf718c5962d
2,016
25,996
def power(m, n): m = m ** n return m
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
93426de2-87e4-4c00-9910-de51627bd576
2,016
3,372
def power(m, n): m = m ** n return m
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
93426de2-87e4-4c00-9910-de51627bd576
2,016
6,731
def power(m, n): if n == 0: return 1 else: return m ** n
power
power
Raise m to the power of n.
assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1
true
45fe5d71-35bd-4b87-b28c-71b204939543
2,016
1,369
def power(m, n): if n == 0: return 1 else: return m ** n
power
power
Raise m to the power of n.
assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1
true
45fe5d71-35bd-4b87-b28c-71b204939543
2,016
4,964
def minimum(a): m = a[0] for n in a: if m > n: m = n return m
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
f98e9d61-9e86-4fed-86db-3cf718c5962d
2,016
3,534
def minimum(a): m = a[0] for n in a: if m > n: m = n return m
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
f98e9d61-9e86-4fed-86db-3cf718c5962d
2,016
24,125
def minimum(numbers): if len(numbers) == 1: return numbers[0] elif 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
false
3d19e1db-d496-420c-b077-41631364e4f7
2,016
20,145
def power(x, y): return x ** y
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
07676427-a705-4cb7-a5ef-6a1c3c67c950
2,016
19,878
def power(x, y): return x ** y
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
07676427-a705-4cb7-a5ef-6a1c3c67c950
2,016
18,675
def maximum(a): m = a[0] for n in a: if m < n: m = n return m
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
f98e9d61-9e86-4fed-86db-3cf718c5962d
2,016
30,078
def maximum(a): m = a[0] for n in a: if m < n: m = n return m
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
f98e9d61-9e86-4fed-86db-3cf718c5962d
2,016
20,714
def minimum(a): a = sorted(a) return a[0]
minimum
minimum
Return the minimum element in a list of numbers.
assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45
true
8d8fa15f-3f0d-4a69-849b-9b7da96123cd
2,016
10,547
def minimum(a): a = sorted(a) return a[0]
minimum
minimum
Return the minimum element in a list of numbers.
assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45
true
8d8fa15f-3f0d-4a69-849b-9b7da96123cd
2,016
9,577
def minimum(a): a = sorted(a) return a[0]
minimum
minimum
Return the minimum element in a list of numbers.
assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45
true
8d8fa15f-3f0d-4a69-849b-9b7da96123cd
2,016
8,689
def minimum(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 minimum(collection, itera + 1, mini) else: return minimum(collection, itera + 1, mini)
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
e36ebdf2-7cd7-440f-af8b-386d6e2d920f
2,016
5,252
def minimum(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 minimum(collection, itera + 1, mini) else: return minimum(collection, itera + 1, mini)
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
e36ebdf2-7cd7-440f-af8b-386d6e2d920f
2,016
28,209
def minimum(l): return sorted(l)[0]
minimum
minimum
Return the minimum element in a list of numbers.
assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45
true
07676427-a705-4cb7-a5ef-6a1c3c67c950
2,016
39,585
def minimum(l): return sorted(l)[0]
minimum
minimum
Return the minimum element in a list of numbers.
assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45
true
07676427-a705-4cb7-a5ef-6a1c3c67c950
2,016
30,050
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 minimum(collection, itera + 1, mini) else: return minimum(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
false
e36ebdf2-7cd7-440f-af8b-386d6e2d920f
2,016
34,661
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 minimum(collection, itera + 1, mini) else: return minimum(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
false
e36ebdf2-7cd7-440f-af8b-386d6e2d920f
2,016