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
|
---|---|---|---|---|---|---|---|---|
35,619 |
def maximum(l):
if len(l) == 1:
return l[0]
bigger = maximum(l[1:])
if l[0] > bigger:
return l[0]
return bigger
|
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 |
9550e418-a019-49c2-a2e9-8322a300fb6f
| 2,016 |
23,870 |
def fibonacci(n):
if n == 0:
return 0
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
| true |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
7,501 |
def selectionsort(a):
return 'fuck my life and everything in between'
|
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 |
caddc359-e5b0-41d8-94ab-df712d5ea9ce
| 2,016 |
10,218 |
def reverse_list(l):
if len(l) == 1:
return l
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]
| false |
932dfe81-cd49-4d41-8b87-456f3246e781
| 2,016 |
2,381 |
def maximum(lst):
if len(lst) == 1:
return lst[0]
maxi = maximum(lst[1:])
if lst[0] > maxi:
return lst[0]
else:
return maxi
|
maximum
|
maximum
|
Return the maximum element in a list of numbers.
|
assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9
| true |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
8,606 |
def maximum(lst):
if len(lst) == 1:
return lst[0]
maxi = maximum(lst[1:])
if lst[0] > maxi:
return lst[0]
else:
return maxi
|
maximum
|
maximum
|
Return the maximum element in a list of numbers.
|
assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9
| true |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
29,204 |
def minimum(lst):
if len(lst) == 1:
return lst[0]
mini = minimum(lst[1:])
if lst[0] < mini:
return lst[0]
else:
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 |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
24,072 |
def minimum(lst):
if len(lst) == 1:
return lst[0]
mini = minimum(lst[1:])
if lst[0] < mini:
return lst[0]
else:
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 |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
28,461 |
def reverse_list(a):
if a == []:
return []
temp = reverse_list(a[1:])
temp.append(a[0])
return temp
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| true |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
21,558 |
def reverse_list(a):
if a == []:
return []
temp = reverse_list(a[1:])
temp.append(a[0])
return temp
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| true |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
4,813 |
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 |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
27,383 |
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 |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
39,520 |
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 |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
34,373 |
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 |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
7,922 |
def reverse_list(l):
if len(l) == 1 or not l:
return l
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 |
932dfe81-cd49-4d41-8b87-456f3246e781
| 2,016 |
32,066 |
def reverse_list(l):
if len(l) == 1 or not l:
return l
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 |
932dfe81-cd49-4d41-8b87-456f3246e781
| 2,016 |
42,297 |
def reverse_list(ls):
return ls.reverse()
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| false |
1c2a27a6-b2a2-47c9-b19f-39d39288a873
| 2,016 |
20,480 |
def power(m, n):
if n == 0:
return 0
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
| false |
59b507a0-b0a2-42b7-a6af-736ab71c8fe1
| 2,016 |
7,494 |
def selectionsort(a):
start = time.time()
i = 0
while i < len(a):
j = i + 1
p = i
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
a[p], a[i] = a[i], a[p]
i += 1
return a
|
selectionsort
|
selectionsort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None
| false |
caddc359-e5b0-41d8-94ab-df712d5ea9ce
| 2,016 |
12,434 |
def selectionsort(a):
start = time.time()
i = 0
while i < len(a):
j = i + 1
p = i
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
a[p], a[i] = a[i], a[p]
i += 1
return a
|
selectionsort
|
selectionsort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None
| false |
caddc359-e5b0-41d8-94ab-df712d5ea9ce
| 2,016 |
116 |
def power(m, n):
if m == m ** n:
return m
else:
m = m ** n
return power(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
| false |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
31,415 |
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 |
98d44d17-92f8-4274-915e-b88bdd9dca26
| 2,016 |
23,777 |
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 |
98d44d17-92f8-4274-915e-b88bdd9dca26
| 2,016 |
42,175 |
def power(m, n):
if m == 1:
return m
else:
m = m ** n
return power(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
| false |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
28,460 |
def reverse_list(l):
if len(l) == 1:
return l
else:
return reverse_list(l[1:]).append(l[0])
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| false |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
5,043 |
def power(m, n):
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
| false |
59b507a0-b0a2-42b7-a6af-736ab71c8fe1
| 2,016 |
31,378 |
def power(m, n):
if n == 0:
return m
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
| false |
59b507a0-b0a2-42b7-a6af-736ab71c8fe1
| 2,016 |
23,199 |
def fibonacci(n):
return n * fibonacci(n - 1)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| false |
932dfe81-cd49-4d41-8b87-456f3246e781
| 2,016 |
27,605 |
def reverse_list(ls):
ls.reverse()
return ls
|
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 |
1c2a27a6-b2a2-47c9-b19f-39d39288a873
| 2,016 |
41,796 |
def reverse_list(ls):
ls.reverse()
return ls
|
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 |
1c2a27a6-b2a2-47c9-b19f-39d39288a873
| 2,016 |
41,169 |
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 |
932dfe81-cd49-4d41-8b87-456f3246e781
| 2,016 |
17,978 |
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 |
932dfe81-cd49-4d41-8b87-456f3246e781
| 2,016 |
33,460 |
def reverse_list(l):
if l == []:
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 |
fe81d9d2-29fa-4a6b-abc0-109c9697b557
| 2,016 |
7,371 |
def reverse_list(l):
if l == []:
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 |
fe81d9d2-29fa-4a6b-abc0-109c9697b557
| 2,016 |
5,709 |
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 |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
35,006 |
def minimum(l):
smallest = l[0]
for e in l:
if e < smallest:
smallest = e
return smallest
|
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 |
a493c80e-3567-462a-bcbe-7bd974d52d8a
| 2,016 |
28,874 |
def minimum(l):
smallest = l[0]
for e in l:
if e < smallest:
smallest = e
return smallest
|
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 |
a493c80e-3567-462a-bcbe-7bd974d52d8a
| 2,016 |
24,216 |
def power(m, n):
if m == 0:
return 1
else:
m = m ** n
return power(m - 1, n)
|
power
|
power
|
Raise m to the power of n.
|
assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1
| false |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
16,612 |
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 |
b13f3dba-a06b-4528-a4d8-c2ee1a5bb34d
| 2,016 |
34,978 |
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 |
b13f3dba-a06b-4528-a4d8-c2ee1a5bb34d
| 2,016 |
20,343 |
def power(m, n):
if m == 0:
return 1
else:
m = m ** n
return n * power(m - 1, n)
|
power
|
power
|
Raise m to the power of n.
|
assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1
| false |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
13,040 |
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 |
9550e418-a019-49c2-a2e9-8322a300fb6f
| 2,016 |
28,113 |
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 |
9550e418-a019-49c2-a2e9-8322a300fb6f
| 2,016 |
30,697 |
def maximum(l):
biggest = l[0]
for e in l:
if e < biggest:
biggest = e
return biggest
|
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 |
a493c80e-3567-462a-bcbe-7bd974d52d8a
| 2,016 |
36,084 |
def reverse_list(a):
if a == []:
return []
tmp = reverse_list(a[1:])
tmp.append(a[0])
return tmp
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| true |
b13f3dba-a06b-4528-a4d8-c2ee1a5bb34d
| 2,016 |
7,944 |
def reverse_list(a):
if a == []:
return []
tmp = reverse_list(a[1:])
tmp.append(a[0])
return tmp
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| true |
b13f3dba-a06b-4528-a4d8-c2ee1a5bb34d
| 2,016 |
35,678 |
def maximum(l):
biggest = l[0]
for e in l:
if e > biggest:
biggest = e
return biggest
|
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 |
a493c80e-3567-462a-bcbe-7bd974d52d8a
| 2,016 |
23,182 |
def maximum(l):
biggest = l[0]
for e in l:
if e > biggest:
biggest = e
return biggest
|
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 |
a493c80e-3567-462a-bcbe-7bd974d52d8a
| 2,016 |
36,940 |
def power(m, n):
return power(m - 1, n)
|
power
|
power
|
Raise m to the power of n.
|
assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1
| false |
a72d6534-1b96-4a41-95a5-f71f23e2bd99
| 2,016 |
33,275 |
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 |
59b507a0-b0a2-42b7-a6af-736ab71c8fe1
| 2,016 |
42,269 |
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 |
59b507a0-b0a2-42b7-a6af-736ab71c8fe1
| 2,016 |
13,498 |
def reverse_list(l):
if len(l) == 1:
return l
else:
return reverse_list(l[1:]).append(l[0])
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| false |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
25,421 |
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 |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
40,486 |
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 |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
15,580 |
def fibonacci(n):
if n == 0:
return 1
if n == 1:
return 1
return fibonacci(n - 1) + fibonacci(n - 2)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| false |
b13f3dba-a06b-4528-a4d8-c2ee1a5bb34d
| 2,016 |
11,369 |
def fibonacci(n):
if n == 0:
return 1
if n == 1:
return 1
return fibonacci(n - 1) + fibonacci(n - 2)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| false |
b13f3dba-a06b-4528-a4d8-c2ee1a5bb34d
| 2,016 |
875 |
def reverse_list(l):
if len(l) == 1:
return list(l)
else:
return reverse_list(l[1:]).append(l[0])
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| false |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
10,127 |
def count_letters(s):
if not 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 |
98d44d17-92f8-4274-915e-b88bdd9dca26
| 2,016 |
34,016 |
def count_letters(s):
if not 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 |
98d44d17-92f8-4274-915e-b88bdd9dca26
| 2,016 |
20,773 |
def reverse_list(l):
if l == []:
return []
if len(l) == 1:
return l
else:
return reverse_list(l[1:]).append(l[0])
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| false |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
17,560 |
def reverse_list(l):
if not l:
return []
else:
return reverse_list(l[1:]).append(l[0])
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| false |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
36,019 |
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 |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
35,737 |
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 |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
14,291 |
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 |
9550e418-a019-49c2-a2e9-8322a300fb6f
| 2,016 |
40,223 |
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 |
9550e418-a019-49c2-a2e9-8322a300fb6f
| 2,016 |
35,715 |
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 |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
10,824 |
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 |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
20,082 |
def minimum(a):
m = a[0]
for n in a:
if n < m:
n == m
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
| false |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
1,501 |
def fibonacci(n):
if n == 0:
return 1
if n == 1:
return 1
else:
return fibonacci(n - 1) + fibonacci(n - 2)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| false |
fe81d9d2-29fa-4a6b-abc0-109c9697b557
| 2,016 |
2,190 |
def fibonacci(n):
if n == 0:
return 1
if n == 1:
return 1
else:
return fibonacci(n - 1) + fibonacci(n - 2)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| false |
fe81d9d2-29fa-4a6b-abc0-109c9697b557
| 2,016 |
13,630 |
def minimum(a):
m = a[0]
for n in a:
if n < m:
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 |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
18,101 |
def minimum(a):
m = a[0]
for n in a:
if n < m:
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 |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
21,027 |
def maximum(a):
m = a[0]
for n in a:
if n > m:
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 |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
7,935 |
def maximum(a):
m = a[0]
for n in a:
if n > m:
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 |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
4,680 |
def reverse_list(l):
if not l:
return l
else:
temp = reverse_list(l[1:])
temp.append(l[0])
return temp
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| true |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
37,122 |
def reverse_list(l):
if not l:
return l
else:
temp = reverse_list(l[1:])
temp.append(l[0])
return temp
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| true |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
26,233 |
def count_letters(s):
i = 0
for c in s:
i += 1
return i
|
count_letters
|
count_letters
|
Return the number of lettres in a string.
|
assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13
| true |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
31,311 |
def count_letters(s):
i = 0
for c in s:
i += 1
return i
|
count_letters
|
count_letters
|
Return the number of lettres in a string.
|
assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13
| true |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
3,864 |
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 |
59b507a0-b0a2-42b7-a6af-736ab71c8fe1
| 2,016 |
33,045 |
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 |
59b507a0-b0a2-42b7-a6af-736ab71c8fe1
| 2,016 |
4,192 |
def count_letters(word):
if not word:
return 0
return 1 + word[:-1]
|
count_letters
|
count_letters
|
Return the number of lettres in a string.
|
assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13
| false |
a493c80e-3567-462a-bcbe-7bd974d52d8a
| 2,016 |
20,633 |
def reverse_list(a):
b = []
for s in a:
b.append(-1)
return b
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| false |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
6,718 |
def count_letters(word):
if not word:
return 0
return 1 + count_letters(word[:-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 |
a493c80e-3567-462a-bcbe-7bd974d52d8a
| 2,016 |
876 |
def count_letters(word):
if not word:
return 0
return 1 + count_letters(word[:-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 |
a493c80e-3567-462a-bcbe-7bd974d52d8a
| 2,016 |
357 |
def reverse_list(a):
b = []
i = 0
while i < len(a):
b.append(a[-i - 1])
i += 1
return b
|
reverse_recur
|
reverse_list
|
Recursively reverse a list of elements.
|
assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85]
| true |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
11,031 |
def swap(l, i, j):
temp = l[i]
l[i] = l[j]
l[j] = temp
def quicksort(l, p, r):
if r <= p:
return l
q = p
for j in range(p, r):
if l[j] <= l[r]:
swap(l, j, q)
q += 1
swap(l, q, r)
quicksort(l, p, q - 1)
quicksort(l, q + 1, r)
return 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 |
932dfe81-cd49-4d41-8b87-456f3246e781
| 2,016 |
36,103 |
def swap(l, i, j):
temp = l[i]
l[i] = l[j]
l[j] = temp
def quicksort(l, p, r):
if r <= p:
return l
q = p
for j in range(p, r):
if l[j] <= l[r]:
swap(l, j, q)
q += 1
swap(l, q, r)
quicksort(l, p, q - 1)
quicksort(l, q + 1, r)
return 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 |
932dfe81-cd49-4d41-8b87-456f3246e781
| 2,016 |
21,608 |
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 A
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 |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
1,940 |
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 A
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 |
72de96bc-40bc-48ca-b1c3-91150748b31a
| 2,016 |
13,323 |
def fibonacci(n):
a = 0
b = 1
while a < n:
a += b
a, b = b, a
print(a)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| false |
1c2a27a6-b2a2-47c9-b19f-39d39288a873
| 2,016 |
37,574 |
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 |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
26,783 |
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 |
0473ca8a-3862-4046-a34c-16eb754fdfff
| 2,016 |
12,527 |
def fibonacci(n):
a = 0
b = 1
l = []
while a < n:
a += b
a, b = b, a
l.append(a)
return l(len.l() - 1)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| false |
1c2a27a6-b2a2-47c9-b19f-39d39288a873
| 2,016 |
21,564 |
def fibonacci(n):
if n == 0 or n == 1:
return 1
else:
return fibonacci(n - 1) + fibonacci(n - 2)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| false |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
16,794 |
def fibonacci(n):
if n == 0 or n == 1:
return 1
else:
return fibonacci(n - 1) + fibonacci(n - 2)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| false |
3bcffc16-908f-42c5-9ac3-f685ae6eca33
| 2,016 |
33,325 |
def partition(l, p, r):
q = j = p
while j < r:
if l[j] <= l[r]:
l[q], l[j] = l[j], l[q]
q += 1
j += 1
l[q], l[r] = l[r], l[q]
return q
def quicksort(l, p, r):
if r <= p:
return l
q = partition(l, p, r)
quicksort(l, p, q - 1)
quicksort(l, 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 |
b13f3dba-a06b-4528-a4d8-c2ee1a5bb34d
| 2,016 |
35,590 |
def partition(l, p, r):
q = j = p
while j < r:
if l[j] <= l[r]:
l[q], l[j] = l[j], l[q]
q += 1
j += 1
l[q], l[r] = l[r], l[q]
return q
def quicksort(l, p, r):
if r <= p:
return l
q = partition(l, p, r)
quicksort(l, p, q - 1)
quicksort(l, 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 |
b13f3dba-a06b-4528-a4d8-c2ee1a5bb34d
| 2,016 |
7,496 |
def reverse_list(l):
if not l:
return []
return reverse_list[0].append(reverse_list[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]
| false |
a493c80e-3567-462a-bcbe-7bd974d52d8a
| 2,016 |
21,463 |
def reverse_list(l):
if not l:
return []
return reverse_list[0].append(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]
| false |
a493c80e-3567-462a-bcbe-7bd974d52d8a
| 2,016 |
24,090 |
def reverse_list(l):
if not l:
return []
return l[0].append(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]
| false |
a493c80e-3567-462a-bcbe-7bd974d52d8a
| 2,016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.