submission_id
int32 10
42.5k
| func_code
stringlengths 22
782
| assignment_id
stringlengths 4
23
| func_name
stringlengths 4
23
| description
stringlengths 26
128
| test
stringlengths 45
1.22k
| correct
bool 2
classes | user
stringlengths 36
36
| academic_year
int32 2.02k
2.02k
|
---|---|---|---|---|---|---|---|---|
30,218 | 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 | 44c97823-e1ac-4434-b296-79fbeb51fa5a | 2,016 |
6,667 | def search(s, letter):
if len(s) == 0:
return 'False'
elif s[0] == letter:
return 'True'
else:
return search(s[1:], letter) | search_recur | search | Recursively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | false | 44c97823-e1ac-4434-b296-79fbeb51fa5a | 2,016 |
15,259 | def index(s, letter, pos):
if pos == len(s):
return '-1'
elif s[pos] == letter:
return pos
else:
return index(s, letter, pos + 1) | index_recur | index | Recursively search for the position of letter in str, return -1 if it is not there. | assert index('','0',0)==-1 and index('0','0',0)==0 and index('a','8',0)==-1 and index('tV2','2',0)==2 | false | 44c97823-e1ac-4434-b296-79fbeb51fa5a | 2,016 |
38,594 | def search(s, letter):
if len(s) == 0:
return 'False'
elif s[0] == letter:
return 'True'
else:
return search(s[1:], letter) | search_recur | search | Recursively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | false | 44c97823-e1ac-4434-b296-79fbeb51fa5a | 2,016 |
18,523 | 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 | 44c97823-e1ac-4434-b296-79fbeb51fa5a | 2,016 |
37,549 | def index(s, letter, pos):
if pos == len(s):
return '-1'
elif s[pos] == letter:
return pos
else:
return index(s, letter, pos + 1) | index_recur | index | Recursively search for the position of letter in str, return -1 if it is not there. | assert index('','0',0)==-1 and index('0','0',0)==0 and index('a','8',0)==-1 and index('tV2','2',0)==2 | false | 44c97823-e1ac-4434-b296-79fbeb51fa5a | 2,016 |
41,888 | def search(s, letter):
if len(s) == 0:
return 'False'
elif s[0] == letter:
return 'True'
else:
return search(s[1:], letter) | search_recur | search | Recursively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | false | 44c97823-e1ac-4434-b296-79fbeb51fa5a | 2,016 |
33,519 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
6,653 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
12,381 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
23,185 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
12,571 | def maximum(l):
if len(l) == 1:
return l[0]
tail_max = maximum(l[1:])
return l[0] if l[0] > tail_max else tail_max | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
30,894 | def maximum(l):
if len(l) == 1:
return l[0]
tail_max = maximum(l[1:])
return l[0] if l[0] > tail_max else tail_max | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
35,289 | def minimum(l):
if len(l) == 1:
return l[0]
tail_min = minimum(l[1:])
return l[0] if l[0] < tail_min else tail_min | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
29,802 | def minimum(l):
if len(l) == 1:
return l[0]
tail_min = minimum(l[1:])
return l[0] if l[0] < tail_min else tail_min | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
20,232 | def minimum(l):
if len(l) == 1:
return l[0]
tail_min = minimum(l[1:])
return l[0] if l[0] < tail_min else tail_min | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
27,604 | def power(m, n):
if not n:
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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
27,068 | def power(m, n):
if not n:
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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
41,848 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
30,650 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
18,484 | def reverse_list(l):
if l == []:
return []
return reverse_list(l[1:]) + [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] | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
6,503 | def reverse_list(l):
if l == []:
return []
return reverse_list(l[1:]) + [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] | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
35,403 | def selectionsort(A):
i = 0
while i < len(A):
min_index = i
j = i + 1
while j < len(A):
if A[j] < A[min_index]:
min_index = j
j += 1
A[i], A[min_index] = A[min_index], A[i]
i += 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
14,034 | def selectionsort(A):
i = 0
while i < len(A):
min_index = i
j = i + 1
while j < len(A):
if A[j] < A[min_index]:
min_index = j
j += 1
A[i], A[min_index] = A[min_index], A[i]
i += 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
20,059 | def selectionsort(A):
i = 0
while i < len(A):
min_index = i
j = i + 1
while j < len(A):
if A[j] < A[min_index]:
min_index = j
j += 1
A[i], A[min_index] = A[min_index], A[i]
i += 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
21,061 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
x = (x2 - x1) ** 2
y = (y2 - y1) ** 2
distance = sqrt(x + y)
return r1 + r2 > distance | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | false | 0473ca8a-3862-4046-a34c-16eb754fdfff | 2,016 |
9,576 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
x = (x2 - x1) ** 2
y = (y2 - y1) ** 2
distance = sqrt(x + y)
return r1 + r2 > distance | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | false | 0473ca8a-3862-4046-a34c-16eb754fdfff | 2,016 |
3,076 | def fibonacci(n):
a = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
return a[n] | fibonacci_iter | fibonacci | Iteratively compute the value of the fibonacci series at position n. | assert fibonacci(1)==1 and fibonacci(41)==165580141 and fibonacci(3)==2 and fibonacci(91)==4660046610375530309 | false | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
5,676 | def search(str, letter):
for item in str:
if item == letter:
return True
return False | search_iter | search | Iteratively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | true | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
18,205 | def search(str, letter):
for item in str:
if item == letter:
return True
return False | search_iter | search | Iteratively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | true | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
24,827 | def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return i
i = i + 1
return -1 | index_iter | index | Iteratively search for the position of letter in str, return -1 if it is not there. | assert index('','0')==-1 and index('0','0')==0 and index('11','1')==0 | true | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
14,191 | def fibonacci(n):
a = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
return a[n] | fibonacci_iter | fibonacci | Iteratively compute the value of the fibonacci series at position n. | assert fibonacci(1)==1 and fibonacci(41)==165580141 and fibonacci(3)==2 and fibonacci(91)==4660046610375530309 | false | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
11,365 | def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return i
i = i + 1
return -1 | index_iter | index | Iteratively search for the position of letter in str, return -1 if it is not there. | assert index('','0')==-1 and index('0','0')==0 and index('11','1')==0 | true | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
36,181 | def fibonacci(n):
a = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
return a[n] | 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 | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
34,322 | def search(str, letter):
for item in str:
if item == letter:
return True
return False | search_recur | search | Recursively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | true | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
26,601 | def index(str, letter, pos):
if pos == len(str):
return -1
elif str[pos] == letter:
return pos
else:
return index(str, letter, pos + 1) | index_recur | index | Recursively search for the position of letter in str, return -1 if it is not there. | assert index('','0',0)==-1 and index('0','0',0)==0 and index('a','8',0)==-1 and index('tV2','2',0)==2 | true | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
42,436 | def fibonacci(n):
a = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
return a[n] | 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 | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
26,899 | def search(str, letter):
for item in str:
if item == letter:
return True
return False | search_recur | search | Recursively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | true | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
4,786 | def index(str, letter, pos):
if pos == len(str):
return -1
elif str[pos] == letter:
return pos
else:
return index(str, letter, pos + 1) | index_recur | index | Recursively search for the position of letter in str, return -1 if it is not there. | assert index('','0',0)==-1 and index('0','0',0)==0 and index('a','8',0)==-1 and index('tV2','2',0)==2 | true | 662f087e-9c5b-47c6-8644-ba7525600aac | 2,016 |
26,693 | def index(str, letter):
i = 0
while i < len(str):
if letter == str[i]:
return i
i = i + 1
return -1 | index_iter | index | Iteratively search for the position of letter in str, return -1 if it is not there. | assert index('','0')==-1 and index('0','0')==0 and index('11','1')==0 | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
18,096 | def index(str, letter):
i = 0
while i < len(str):
if letter == str[i]:
return i
i = i + 1
return -1 | index_iter | index | Iteratively search for the position of letter in str, return -1 if it is not there. | assert index('','0')==-1 and index('0','0')==0 and index('11','1')==0 | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
6,864 | def search(str, letter):
i = 0
while i < len(str):
if letter == str[i]:
return True
i = i + 1
return False | search_iter | search | Iteratively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
2,745 | def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
fibN_2 = 0
fibN_1 = 1
i = 2
while i <= n:
fibN = fibN_2 + fibN_1
fibN_2 = fibN_1
fibN_1 = fibN
i = i + 1
return fibN | fibonacci_iter | fibonacci | Iteratively compute the value of the fibonacci series at position n. | assert fibonacci(1)==1 and fibonacci(41)==165580141 and fibonacci(3)==2 and fibonacci(91)==4660046610375530309 | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
21,492 | def search(str, letter):
i = 0
while i < len(str):
if letter == str[i]:
return True
i = i + 1
return False | search_iter | search | Iteratively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
32,298 | def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
fibN_2 = 0
fibN_1 = 1
i = 2
while i <= n:
fibN = fibN_2 + fibN_1
fibN_2 = fibN_1
fibN_1 = fibN
i = i + 1
return fibN | fibonacci_iter | fibonacci | Iteratively compute the value of the fibonacci series at position n. | assert fibonacci(1)==1 and fibonacci(41)==165580141 and fibonacci(3)==2 and fibonacci(91)==4660046610375530309 | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
16,929 | def search(str, letter):
if str == '':
return False
elif str[0] == letter:
return True
else:
return search(str[1:], letter) | search_recur | search | Recursively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
13,054 | def index(str, letter, pos):
if pos == len(str):
return -1
elif str[pos] == letter:
return pos
else:
return index(str, letter, pos + 1) | index_recur | index | Recursively search for the position of letter in str, return -1 if it is not there. | assert index('','0',0)==-1 and index('0','0',0)==0 and index('a','8',0)==-1 and index('tV2','2',0)==2 | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
41,444 | def search(str, letter):
if str == '':
return False
elif str[0] == letter:
return True
else:
return search(str[1:], letter) | search_recur | search | Recursively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
28,819 | def index(str, letter, pos):
if pos == len(str):
return -1
elif str[pos] == letter:
return pos
else:
return index(str, letter, pos + 1) | index_recur | index | Recursively search for the position of letter in str, return -1 if it is not there. | assert index('','0',0)==-1 and index('0','0',0)==0 and index('a','8',0)==-1 and index('tV2','2',0)==2 | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
25,895 | 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 | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
39,831 | 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 | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
27,185 | 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 | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
34,417 | def search(str, letter):
if str == '':
return False
elif str[0] == letter:
return True
else:
return search(str[1:], letter) | search_recur | search | Recursively search for a letter in a string | assert search('','0')==False and search('0','0')==True and search('ERFE0Rfsef','0')==True and search('ERFERfsef0','0')==True and search('','a')==False and search('cbzeycuzbvyzuvb','a')==False and search('cbsducsvdbcyts','c')==True and search('dbzeducvbzy','y')==True and search('xqvsgxcutvy','u')==True | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
21,306 | def index(str, letter, pos):
if pos == len(str):
return -1
elif str[pos] == letter:
return pos
else:
return index(str, letter, pos + 1) | index_recur | index | Recursively search for the position of letter in str, return -1 if it is not there. | assert index('','0',0)==-1 and index('0','0',0)==0 and index('a','8',0)==-1 and index('tV2','2',0)==2 | true | 1bdd9f47-4a26-4f0c-ae56-413531e3f59b | 2,016 |
9,444 | def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
return l2 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
12,495 | def append2list(l1):
l2 = []
for i in l1:
l2.append(i)
return l2 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | false | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
41,652 | def append2list(l1, l2=[]):
l3 = []
for i in l1:
l3.append(i)
return l3 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | false | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
2,681 | def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
l3 = l2
l2 = []
return l3 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
17,035 | def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
l3 = []
l3 = l2
l2 = []
return l3 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
11,653 | def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
return l2
l2 = [] | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
15,141 | def append2list(l1, l2=[]):
for i in l1:
l2.append(i)
l3 = l2
l2 = []
return l3 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
25,960 | def append2list(l1, l2=[]):
if l2 == []:
l3 = []
for i in l1:
l3.append(i)
return l3
for i in l1:
l2.append(i)
return l2 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
36,882 | def append2list(l1, l2=[]):
if l2 == []:
l3 = []
for i in l1:
l3.append(i)
return l3
else:
for i in l1:
l2.append(i)
return l2 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
20,203 | def append2list(l1, l2=[]):
if l2 == None:
l3 = []
for i in l1:
l3.append(i)
return l3
else:
for i in l1:
l2.append(i)
return l2 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
16,887 | def append2list(l1, l2=[]):
if l2 == None:
l3 = []
for i in l1:
l3.append(i)
return l3
else:
for i in l1:
l2.append(i)
return l2 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
40,932 | def append2list(l1, l2=[]):
if l2 == None:
l3 = []
for i in l1:
l3.append(i)
return l3
else:
for i in l1:
l2.append(i)
return l2 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 11236dde-1cd4-4a17-af9c-b06843cf22cc | 2,016 |
4,060 | def append2list(l1, l2=[]):
if l2:
for i in l1:
l2.append(i)
return l2
else:
return l1 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 427cdab9-477f-4fb3-92b0-bf5eef785c90 | 2,016 |
11,453 | def append2list(l1, l2=[]):
if l2:
for i in l1:
l2.append(i)
return l2
else:
return l1 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | 427cdab9-477f-4fb3-92b0-bf5eef785c90 | 2,016 |
40,825 | _A = None
def overlap(x1=_A, y1=_A, r1=_A, x2=_A, y2=_A, r2=_A):
if x1 is _A:
x1 = 0
if y1 is _A:
y1 = 0
if r1 is _A:
r1 = 1
if x2 is _A:
x2 = 0
if y2 is _A:
y2 = 0
if r2 is _A:
r2 = 1 | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | false | 427cdab9-477f-4fb3-92b0-bf5eef785c90 | 2,016 |
5,730 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
a = (x2 - x1) ** 2
b = (y2 - y1) ** 2
c = (a + b) ** 0.5
total_r = r1 + r2
if c < total_r:
return True
else:
return False | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | true | f6343d5f-9ee0-441c-a67c-781ee180947e | 2,016 |
15,340 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
a = (x2 - x1) ** 2
b = (y2 - y1) ** 2
c = (a + b) ** 0.5
total_r = r1 + r2
if c < total_r:
return True
else:
return False | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | true | f6343d5f-9ee0-441c-a67c-781ee180947e | 2,016 |
26,771 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
a = (x2 - x1) ** 2
b = (y2 - y1) ** 2
c = (a + b) ** 0.5
total_r = r1 + r2
if c < total_r:
return True
else:
return False | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | true | f6343d5f-9ee0-441c-a67c-781ee180947e | 2,016 |
24,967 | def append2list(l1, l2=None):
if l2 == None:
l2 = []
for i in l1:
l2.append(i)
return l2 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | b46a0d8e-c049-41aa-b896-956cda3c8d13 | 2,016 |
20,851 | def append2list(l1, l2=None):
if l2 == None:
l2 = []
for i in l1:
l2.append(i)
return l2 | append2list | append2list | Appends elements of a list l1 at the end of the list l2. If l2 not supplied default to empty list. | assert append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866],[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866])==[-16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866, -16276, 117, -12248, -4743, -25, -6030600119498841921, -8866, -12248, -4743, -25, -6030600119498841921, -8866] and append2list([-21267],[-21267, -21267])==[-21267, -21267, -21267] | true | b46a0d8e-c049-41aa-b896-956cda3c8d13 | 2,016 |
21,838 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
return (x1 * x2) ** 2 + (y1 * y2) ** 2 < (r1 + r2) ** 2 | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | false | b46a0d8e-c049-41aa-b896-956cda3c8d13 | 2,016 |
27,785 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
return ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5 < r1 + r2 | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | true | b46a0d8e-c049-41aa-b896-956cda3c8d13 | 2,016 |
24,806 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
return ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5 < r1 + r2 | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | true | b46a0d8e-c049-41aa-b896-956cda3c8d13 | 2,016 |
7,808 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
return ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5 < r1 + r2 | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | true | b46a0d8e-c049-41aa-b896-956cda3c8d13 | 2,016 |
4,601 | def overlap(x1=0, y1=0, r1=1, x2=0, y2=0, r2=1):
return ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5 < r1 + r2 | overlap | overlap | Test if two circles overlap. | assert overlap(12,-6058,21436,-3483096651887624530,24,31017)==False and overlap(-30592,-26624,-11905,1,2,30134)==False and overlap(0,0,0,0,0,0)==False and overlap(5128,-8635,-28938,25,-31295,-21637807133189218411179185993653430151)==False and overlap(-16348,-2218,2871,-15155,-83,24475)==True and overlap(4807,1216206119,8753907074291481720,-19844,-26061,-15639)==True and overlap(1348593950,19232,-10923,20,2259187900768772679,-5343103208648864320)==False and overlap(8410739119977124611,9995,83,8410739119977124611,19348,21604)==True | true | b46a0d8e-c049-41aa-b896-956cda3c8d13 | 2,016 |
2,958 | def power(m, n):
if not n:
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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
17,969 | def power(m, n):
if not n:
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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
37,167 | def minimum(l):
if len(l) == 1:
return l[0]
tail_min = minimum(l[1:])
return l[0] if l[0] < tail_min else tail_min | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
25,667 | def minimum(l):
if len(l) == 1:
return l[0]
tail_min = minimum(l[1:])
return l[0] if l[0] < tail_min else tail_min | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
16,757 | def maximum(l):
if len(l) == 1:
return l[0]
tail_max = maximum(l[1:])
return l[0] if l[0] > tail_max else tail_max | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
24,386 | def maximum(l):
if len(l) == 1:
return l[0]
tail_max = maximum(l[1:])
return l[0] if l[0] > tail_max else tail_max | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
33,981 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
22,301 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
18,976 | def reverse_list(l):
if l == []:
return []
return reverse_list(l[1:]) + [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] | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
16,906 | def reverse_list(l):
if l == []:
return []
return reverse_list(l[1:]) + [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] | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
18,694 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
6,460 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
41,691 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
6,792 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
42,440 | 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 | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
12,690 | def selectionsort(A):
i = 0
while i < len(A):
min_index = i
j = i + 1
while j < len(A):
if A[j] < A[min_index]:
min_index = j
j += 1
A[i], A[min_index] = A[min_index], A[i]
i += 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
28,887 | def selectionsort(A):
i = 0
while i < len(A):
min_index = i
j = i + 1
while j < len(A):
if A[j] < A[min_index]:
min_index = j
j += 1
A[i], A[min_index] = A[min_index], A[i]
i += 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
33,852 | def selectionsort(A):
i = 0
while i < len(A):
min_index = i
j = i + 1
while j < len(A):
if A[j] < A[min_index]:
min_index = j
j += 1
A[i], A[min_index] = A[min_index], A[i]
i += 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | b1593687-e1b6-4969-bf98-9b229efc6797 | 2,016 |
25,560 | 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 | 9550e418-a019-49c2-a2e9-8322a300fb6f | 2,016 |
23,762 | 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 | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
25,619 | def selectionsort(a):
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.