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
|
---|---|---|---|---|---|---|---|---|
38,012 |
def search(str, letter):
i = 0
while i < len(str):
if letter == str[i]:
break
print('True')
else:
print('False')
i += 1
|
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
| false |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
28,579 |
def search(str, letter):
i = 0
while i < len(str):
if letter == str[i]:
print('True')
else:
print('False')
i += 1
|
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
| false |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
41,624 |
def search(str, letter):
if letter in str:
print('True')
else:
print('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
| false |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
34,002 |
def search(str, letter):
if letter in str:
print('True'.rstrip())
else:
print('False'.rstrip())
|
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
| false |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
22,433 |
def search(str, letter):
if letter in str:
return 'True'.rstrip()
else:
return 'False'.rstrip()
|
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
| false |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
1,468 |
def index(str, letter):
return str.index(letter)
|
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
| false |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
38,168 |
def search(str, letter):
if letter in str:
return 'True'.rstrip()
else:
return 'False'.rstrip()
|
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
| false |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
978 |
def search(str, letter):
if letter in str:
return 'True'.rstrip()
else:
return 'False'.rstrip()
|
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
| false |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
7,683 |
def index(str, letter):
return str.find(letter)
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
34,271 |
def fibonacci(n):
a = 1
b = 1
for i in range(n - 1):
a, b = b, a + b
return a
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
31,447 |
def search(str, letter):
if letter in str:
return 'True'.rstrip()
else:
return 'False'.rstrip()
|
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
| false |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
26,979 |
def index(str, letter):
return str.find(letter)
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
1,136 |
def index(str, letter):
return str.find(letter)
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
14,096 |
def search(str, letter):
if letter in str:
return 'True'.rstrip()
else:
return 'False'.rstrip()
|
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
| false |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
33,001 |
def index(str, letter):
return str.find(letter)
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
32,840 |
def fibonacci(n):
a = 1
b = 1
if n != 0:
for i in range(n - 1):
a, b = b, a + b
else:
return 0
return a
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
26,995 |
def search(str, letter):
if letter in str:
return 'True'.rstrip()
else:
return 'False'.rstrip()
|
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
| false |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
18,036 |
def fibonacci(n):
a = 1
b = 1
if n != 0:
for i in range(n - 1):
a, b = b, a + b
else:
return 0
return a
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
24,829 |
def fibonacci(n):
a = 1
b = 1
if n != 0:
for i in range(n - 1):
a, b = b, a + b
else:
return 0
return 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
| true |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
20,786 |
def index(str, letter):
return str.find(letter)
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
38,548 |
def search(str, letter):
if letter in str:
return 'True'.rstrip()
else:
return 'False'.rstrip()
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
36,124 |
def search(str, letter):
if letter in str:
return 'True'.rstrip()
else:
return 'False'.rstrip()
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
23,614 |
def search(str, letter):
if letter in str:
return 'True'.rstrip()
else:
return 'False'.rstrip()
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
1,249 |
def fibonacci(n):
a = 1
b = 1
if n != 0:
for i in range(n - 1):
a, b = b, a + b
else:
return 0
return 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
| true |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
33,871 |
def index(str, letter, n):
return str.find(letter)
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
37,659 |
def fibonacci(n):
a = 1
b = 1
if n != 0:
for i in range(n - 1):
a, b = b, a + b
else:
return 0
return 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
| true |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
38,240 |
def index(str, letter, n):
return str.find(letter)
|
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 |
7761b9ac-f093-487b-8401-cf2d01636e78
| 2,016 |
1,720 |
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 |
fe81d9d2-29fa-4a6b-abc0-109c9697b557
| 2,016 |
30,754 |
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 |
fe81d9d2-29fa-4a6b-abc0-109c9697b557
| 2,016 |
28,823 |
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 |
fe81d9d2-29fa-4a6b-abc0-109c9697b557
| 2,016 |
24,528 |
def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
elif n == 2:
return 1
else:
return fibonacci(n - 2) + fibonacci(n - 1)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| true |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
8,409 |
def index(string, letter, pos=0):
if string == '':
return '-1'
elif string[0] == letter:
return pos
else:
pos += 1
return index(string[1:], letter, pos=pos)
|
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 |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
2,313 |
def search(string, letter):
if string == '':
return False
elif string[0] == letter:
return True
else:
return search(string[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 |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
37,895 |
def index(string, letter, pos=0):
if string == '':
return '-1'
elif string[0] == letter:
return pos
else:
pos += 1
return index(string[1:], letter, pos=pos)
|
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 |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
23,982 |
def search(string, letter):
if string == '':
return False
elif string[0] == letter:
return True
else:
return search(string[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 |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
35,208 |
def index(string, letter, pos=0):
if string == '':
return '-1'
elif string[0] == letter:
return pos
else:
pos += 1
return index(string[1:], letter, pos=pos)
|
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 |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
17,438 |
def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
elif n == 2:
return 1
else:
return fibonacci(n - 2) + fibonacci(n - 1)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| true |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
41,906 |
def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
elif n == 2:
return 1
else:
return fibonacci(n - 2) + fibonacci(n - 1)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| true |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
24,751 |
def search(string, letter):
if string == '':
return False
elif string[0] == letter:
return True
else:
return search(string[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 |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
33,237 |
def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
elif n == 2:
return 1
else:
return fibonacci(n - 2) + fibonacci(n - 1)
|
fibonacci_recur
|
fibonacci
|
Recursively compute the value of the fibonacci series at position n.
|
assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657
| true |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
35,739 |
def index(string, letter, pos=0):
if string == '':
return '-1'
elif string[0] == letter:
return pos
else:
pos += 1
return index(string[1:], letter, pos=pos)
|
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 |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
23,672 |
def search(string, letter):
if string == '':
return False
elif string[0] == letter:
return True
else:
return search(string[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 |
813b8c22-4514-4fed-ac48-d5a7a4b068dd
| 2,016 |
42,151 |
def reverse(a):
return a[::-1]
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| true |
1b62c11e-ae6b-4c7f-8eac-f8a9a0acb450
| 2,016 |
561 |
def reverse(a):
i = len(a) - 1
new_array = []
while i >= 0:
new_array.append(a[i])
i -= 1
return new_array
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| true |
1b62c11e-ae6b-4c7f-8eac-f8a9a0acb450
| 2,016 |
35,872 |
def reverse(a):
i = len(a) - 1
new_array = []
while i >= 0:
new_array.append(a[i])
i -= 1
return new_array
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| true |
1b62c11e-ae6b-4c7f-8eac-f8a9a0acb450
| 2,016 |
37,674 |
def reverse(a):
i = len(a) - 1
new_array = []
while i >= 0:
new_array.append(a[i])
i -= 1
return new_array
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| true |
1b62c11e-ae6b-4c7f-8eac-f8a9a0acb450
| 2,016 |
29,303 |
def reverse(a):
i = len(a) - 1
new_array = []
while i >= 0:
new_array.append(a[i])
i -= 1
return new_array
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| true |
1b62c11e-ae6b-4c7f-8eac-f8a9a0acb450
| 2,016 |
39,556 |
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
17,674 |
def fibonacci(n):
a = 0
b = 1
for i in range(0):
c = a + b
return n
a = b
b = c
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
32,826 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
34,632 |
def fibonacci(n):
a = 0
b = 1
for i in range(0, n):
c = a + b
return n
a = b
b = c
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
4,083 |
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
21,494 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
12,064 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
7,786 |
def fibonacci(n):
a = 0
b = 1
for i in range(0, n + 1):
c = a + b
return c
a = b
b = c
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
15,599 |
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
3,398 |
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
24,414 |
def fibonacci(n):
a = 0
b = 1
for i in range(0, n + 1):
c = a + b
return c + 1
a = b
b = c
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
26,052 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
22,609 |
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
17,802 |
def fibonacci(n):
a = 0
b = 1
for i in range(0, n + 1):
c = a + b
return n
a = b
b = c
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
11,744 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
18,894 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
30,626 |
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
37,971 |
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
31,000 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
22,343 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
14,753 |
def fibonacci(n):
a = 0
b = 1
for i in range(0, n + 1):
c = a + b
return n
a = b
b = c
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
32,593 |
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
35,252 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
18,447 |
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
7,334 |
def fibonacci(n):
i = 0
while i < len(n):
if n[i] == 0:
return i
i += 1
return c
c = i + 1
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
18,973 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
2,453 |
def fibonacci(n):
i = 0
while i < len(n):
if n[i] == 0:
return i
i += 1
return c
c = i + 1
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
40,854 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
41,841 |
def fibonacci(n):
i = 0
while i < n:
if n[i] == 0:
return i
i += 1
return c
c = i + 1
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
3,655 |
def fibonacci(n):
i = 0
while i < n:
if n[i] == 0:
return i
i += 1
return c
c = i + 1
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
5,368 |
def fibonacci(n):
i = 0
c = i + 1
while i < n:
if n[i] == 0:
return i
i += 1
return c
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
33,146 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
20,253 |
def fibonacci(n):
i = 0
c = i + 1
while i < n:
if n[i] == 0:
return i
i += 1
return c
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
12,614 |
def fibonacci(n):
i = 0
c = i + 1
while i < n:
if n == 0:
return i
i += 1
return c
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
28,846 |
def fibonacci(n):
i = 0
c = i + 1
while i < n:
if n == 0:
return i
i += 1
return c
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
4,048 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
2,711 |
def fibonacci(n):
i = 0
x = 1
c = i + x
while i < n:
if n == 0:
return i
i += 1
return c
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
16,273 |
def fibonacci(n):
i = 0
x = 1
c = i + x
while i < n:
if n == 0:
return i
i += 1
return c
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
26,189 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
30,392 |
def fibonacci(n):
i = 0
x = 1
c = i + x
while i < n:
if n == 0:
return i
i += 1
c += 1
return c
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
20,631 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
329 |
def fibonacci(n):
i = 0
x = 1
c = i + x
while i < n:
if n == 0:
return i
i += 1
c += 1
return c
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
2,197 |
def fibonacci(n):
i = 0
x = 1
c = i + x
while i < n:
if n == 0:
return i
i += 1
c += 1
return c
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
17,294 |
def fibonacci(n):
i = 0
x = 1
c = i + x
while i < n:
if n == 0:
return i
i += 1
c += 1
return c
|
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
3,230 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
32,472 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
26,235 |
def fibonacci(n):
fib = [0, 1, 1]
for f in range(2, n):
fib.append(fib[-1] + fib[-2])
return fib[n]
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
39,842 |
def fibonacci(n):
fib = [0, 1, 1]
for f in range(2, n):
fib.append(fib[-1] + fib[-2])
return fib[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
| true |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
35,009 |
def fibonacci(n):
fib = [0, 1, 1]
for f in range(2, n):
fib.append(fib[-1] + fib[-2])
return fib[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
| true |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
39,526 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
26,015 |
def fibonacci(n):
fib = [0, 1, 1]
for f in range(2, n):
fib.append(fib[-1] + fib[-2])
return fib[n]
def index(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return 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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
5,673 |
def fibonacci(n):
fib = [0, 1, 1]
for f in range(2, n):
fib.append(fib[-1] + fib[-2])
return fib[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
| true |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
26,241 |
def search(str, letter):
i = 0
while i < len(str):
if str[i] == letter:
return True
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 |
3db8d602-4800-4b13-9482-3fb9643a4588
| 2,016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.