id stringlengths 35 39 | content stringlengths 44 3.85k | max_stars_repo_path stringlengths 52 57 |
|---|---|---|
refactory_data_question_1_correct_1_268 | def search(x, seq):
if len(seq) == 0:
return 0
else:
for i,elem in enumerate(seq):
if x > elem:
continue
return i
return i+1
| ./refactory/data/question_1/code/correct/correct_1_268.py |
refactory_data_question_1_correct_1_506 | def search(x, seq):
index = 0
while index < len(seq):
if x <= seq[index]:
break
else:
index += 1
return index
| ./refactory/data/question_1/code/correct/correct_1_506.py |
refactory_data_question_1_correct_1_271 | def search(x, seq):
for i, elem in enumerate(seq):
if elem < x:
continue
elif elem == x:
return i
elif elem > x:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_271.py |
refactory_data_question_1_correct_1_398 | #def search(x, seq):
# if len(seq)==0:
# return 0
# for i in range(len(seq)):
# if x<= seq[i]:
# a=i
# break
# elif x> seq[len(seq)-1]:
# a=len(seq)
#return a
#def search(x, seq):
# if len(seq)==0:
# a=0
# elif x>seq[len(seq)-1]:
# a= ... | ./refactory/data/question_1/code/correct/correct_1_398.py |
refactory_data_question_1_correct_1_558 | def search(x, seq):
pos = 0
for i, element in enumerate(seq):
if x <= element:
pos = i
return pos
else:
pos += 1
return pos
| ./refactory/data/question_1/code/correct/correct_1_558.py |
refactory_data_question_1_correct_1_174 | def search(x, seq):
k = 0
for i in range(len(seq)):
if x <= seq[i]:
break
k = i + 1
return k
| ./refactory/data/question_1/code/correct/correct_1_174.py |
refactory_data_question_1_correct_1_397 | def search(x, seq):
for i, ele in enumerate(seq):
if ele >= x:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_397.py |
refactory_data_question_1_correct_1_368 | def search(x, seq):
if len(seq) == 0:
return 0
elif x < seq[0]:
return 0
elif x > seq[-1]:
return len(seq)
else:
for i in seq:
if x > i:
continue
else:
return seq.index(i)
| ./refactory/data/question_1/code/correct/correct_1_368.py |
refactory_data_question_1_correct_1_528 | def search(x, seq):
for i in range(len(seq)-1):
if x < seq[0]:
return 0
elif seq[i] <= x <= seq[i+1]:
return i+1
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_528.py |
refactory_data_question_1_correct_1_524 | def search(x, seq):
if len(seq)==0:
return 0
else:
if x <= seq[0]:
return 0
elif x > seq[-1]:
return len(seq)
else:
for i in range(0, len(seq)-1):
if seq[i] <= x <= seq[i+1]:
return i+1
| ./refactory/data/question_1/code/correct/correct_1_524.py |
refactory_data_question_1_correct_1_285 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
for i, element in enumerate(seq):
if x <= element:
return i
else:
continue
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_285.py |
refactory_data_question_1_correct_1_632 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
if len(seq) == 0:
return 0
for i in range(len(seq)):
if x <= seq[i]:
return i
if x > seq[-1]:
return len(se... | ./refactory/data/question_1/code/correct/correct_1_632.py |
refactory_data_question_1_correct_1_458 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
position = 0
found = False
while position < len(seq) and not found:
if x <= seq[position]:
found = True
else:
... | ./refactory/data/question_1/code/correct/correct_1_458.py |
refactory_data_question_1_correct_1_286 | def search(x, seq):
a = 0
for i in range(len(seq)):
if x <= seq[i]:
a = i
break
else:
a = len(seq)
return a
| ./refactory/data/question_1/code/correct/correct_1_286.py |
refactory_data_question_1_correct_1_197 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
if seq==() or seq==[] or x<=seq[0]:
return 0
elif x>seq[-1]:
return len(seq)
else:
for i,elem in enumerate(seq):
... | ./refactory/data/question_1/code/correct/correct_1_197.py |
refactory_data_question_1_correct_1_304 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
if len(seq) == 0:
return 0
for i, elem in enumerate(seq):
if x <= elem:
return i
if i == (len(seq)-1):
... | ./refactory/data/question_1/code/correct/correct_1_304.py |
refactory_data_question_1_correct_1_446 | def search(x, seq):
for i in range(len(seq)):
if x <= seq[i]:
return i
else:
continue
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_446.py |
refactory_data_question_1_correct_1_373 | def search(x, seq):
for i, elem in enumerate(seq):
if x <= elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_373.py |
refactory_data_question_1_correct_1_313 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
return
def search(x, seq):
if list(seq) == []:
return 0
else:
for element in seq:
if x <= element:
... | ./refactory/data/question_1/code/correct/correct_1_313.py |
refactory_data_question_1_correct_1_328 | def search(x, seq):
if not seq:
return 0
elif x> seq[-1]:
return len(seq)
for i, elem in enumerate(seq):
if x<=elem:
break
return i
| ./refactory/data/question_1/code/correct/correct_1_328.py |
refactory_data_question_1_correct_1_014 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
for i in range(len(seq)):
if x <= seq[i]:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_014.py |
refactory_data_question_1_correct_1_106 | def search(x, seq):
y = 0
for z in seq:
if x > z:
y += 1
return y
| ./refactory/data/question_1/code/correct/correct_1_106.py |
refactory_data_question_1_correct_1_572 | def search(x, seq):
for position, elem in enumerate(seq):
if x <= elem:
return position #position to insert x
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_572.py |
refactory_data_question_1_correct_1_100 | def search(x, seq):
if seq == () or seq == []:
return 0
else:
count = 0
for i in range (0, len(seq)):
if seq[i] >= x:
return i
elif seq[-1] < x:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_100.py |
refactory_data_question_1_correct_1_459 | def search(x, seq):
position = 0
for i in seq:
if x <= i:
break
position += 1
return position
| ./refactory/data/question_1/code/correct/correct_1_459.py |
refactory_data_question_1_correct_1_224 | def search(x, seq):
if len(seq) == 0:
return 0
elif x > seq[len(seq)-1]:
return len(seq)
elif x < seq[0]:
return 0
else:
for i in seq:
if x > i:
continue
else:
return seq.index(i)
| ./refactory/data/question_1/code/correct/correct_1_224.py |
refactory_data_question_1_correct_1_325 | def search(x, seq):
if len(seq) == 0:
return 0
elif x < seq[0]:
return 0
elif x > seq[len(seq)-1]:
return len(seq)
else:
product = 0
for i in range(len(seq)-1):
if x == seq[i]:
product = i
elif (seq[i] <= x and x <= seq[i+1]... | ./refactory/data/question_1/code/correct/correct_1_325.py |
refactory_data_question_1_correct_1_081 | def search(x, seq):
for i, elem in enumerate(seq):
if x <= elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_081.py |
refactory_data_question_1_correct_1_175 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
counter = 0
for i in seq:
if x > i:
counter += 1
continue
else:
break
return counter... | ./refactory/data/question_1/code/correct/correct_1_175.py |
refactory_data_question_1_correct_1_347 | def search(x, seq):
if seq == [] or seq==():
return 0
elif x<seq[0]:
return 0
elif x>seq[0] and len(seq) == 1:
return 1
else:
for i in range(len(seq)-1):
if seq[i] <= x <= seq[i+1]:
return i+1
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_347.py |
refactory_data_question_1_correct_1_477 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
for i, elem in enumerate(seq):
if x <= elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_477.py |
refactory_data_question_1_correct_1_438 | def search(x, seq):
for i, elem in enumerate(seq):
if x <= elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_438.py |
refactory_data_question_1_correct_1_396 | def search(x,seq):
for i in seq:
if x <= i:
return seq.index(i)
if seq == () or seq == []:
return 0
elif x > seq[len(seq)-1]:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_396.py |
refactory_data_question_1_correct_1_728 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
if seq == [] or seq == ():
return 0
elif type(seq) == tuple:
new_seq = list(seq)
sort = []
for i in range(len(new_s... | ./refactory/data/question_1/code/correct/correct_1_728.py |
refactory_data_question_1_correct_1_551 | def search (x, s):
if not s:
return 0
for i in range (len(s)):
if x<=s[i]:
return i
return i+1
| ./refactory/data/question_1/code/correct/correct_1_551.py |
refactory_data_question_1_correct_1_314 | def search(x, seq):
count=0
while count<len(seq):
if x>seq[count]:
count+=1
continue
else:
return count
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_314.py |
refactory_data_question_1_correct_1_585 | def search(x, seq):
for i, elem in enumerate (seq):
if x <= elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_585.py |
refactory_data_question_1_correct_1_215 | def search(x, seq):
a = 0
for i,j in enumerate(seq):
if x > j and i < len(seq)-1:
continue
elif x <= j:
a = i
break
else:
a = len(seq)
return a
| ./refactory/data/question_1/code/correct/correct_1_215.py |
refactory_data_question_1_correct_1_615 | def search(x, seq):
count=0
for i in seq:
if x<=i:
return count
count+=1
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_615.py |
refactory_data_question_1_correct_1_211 | def search(x, seq):
if len(seq) == 0:
return 0
elif x < seq[0]:
return 0
elif x > seq[-1]:
return len(seq)
else:
for i, elem in enumerate(seq):
if x <= elem:
return i
return None
| ./refactory/data/question_1/code/correct/correct_1_211.py |
refactory_data_question_1_correct_1_710 | def search(x, seq):
pos = 0
for ele in seq:
if x <= ele:
return pos
else:
pos += 1
return pos
| ./refactory/data/question_1/code/correct/correct_1_710.py |
refactory_data_question_1_correct_1_444 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
if seq == () or seq == []:
return 0
elif x > max(seq):
return len(seq)
else:
enumerated = list(enumerate(seq))
... | ./refactory/data/question_1/code/correct/correct_1_444.py |
refactory_data_question_1_correct_1_297 | def search(x, seq):
## """ Takes in a value x and a sorted sequence seq, and returns the
## position that x should go to such that the sequence remains sorted """
n = 0
for num in seq:
if x>num:
n +=1
else:
return n
return n
| ./refactory/data/question_1/code/correct/correct_1_297.py |
refactory_data_question_1_correct_1_440 | def search(x, seq):
position = 0
while position < len(seq):
if seq[position] == x:
break
elif seq[position] > x:
break
position = position + 1
return position
| ./refactory/data/question_1/code/correct/correct_1_440.py |
refactory_data_question_1_correct_1_311 | def search(x, seq):
i = 0
for element in seq:
if x > element:
i = i + 1
return i
| ./refactory/data/question_1/code/correct/correct_1_311.py |
refactory_data_question_1_correct_1_579 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
position = 0
for num in enumerate(seq):
if x <= num[1]:
position = position
elif x > num[1]:
position += 1
... | ./refactory/data/question_1/code/correct/correct_1_579.py |
refactory_data_question_1_correct_1_581 | def search(x, seq):
if seq == () or seq == []:
return 0
for i, elem in enumerate(seq):
if x <= elem:
return i
return i + 1
| ./refactory/data/question_1/code/correct/correct_1_581.py |
refactory_data_question_1_correct_1_523 | def search(x, seq):
if seq == () or seq == []:
return 0
for i in range(len(seq)):
if x > seq[-1]:
return len(seq)
elif x <= seq[i]:
return i
| ./refactory/data/question_1/code/correct/correct_1_523.py |
refactory_data_question_1_correct_1_183 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
for index, value in enumerate(seq):
if x <= value:
return index
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_183.py |
refactory_data_question_1_correct_1_306 | def search(x, seq):
if len(seq)==0:
return 0
for i in range(len(seq)):
if x<=seq[i]:break
if i==len(seq)-1: i+=1
return i
| ./refactory/data/question_1/code/correct/correct_1_306.py |
refactory_data_question_1_correct_1_494 | def search(x, seq):
for i in range(len(seq)):
if x<=seq[i]:
return i
break
else:
continue
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_494.py |
refactory_data_question_1_correct_1_258 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
for i, elem in enumerate(seq):
if x <= elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_258.py |
refactory_data_question_1_correct_1_647 | def search(x, seq):
if seq == () or seq == []:
return 0
else:
for i in range(1,len(seq)):
if x == seq[i]:
return i
elif seq[i-1] < x < seq[i]:
return i
else:
if x > seq[(len(seq))-1]:
return len(se... | ./refactory/data/question_1/code/correct/correct_1_647.py |
refactory_data_question_1_correct_1_252 | def search(x, seq):
counter = 0
for i in seq:
if i< x:
counter += 1
elif i == x or i>x:
break
return counter
| ./refactory/data/question_1/code/correct/correct_1_252.py |
refactory_data_question_1_correct_1_678 | def search(x, seq):
for i in range(len(seq)):
if x <= seq[i]:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_678.py |
refactory_data_question_1_correct_1_107 | def search(x, seq):
if seq == () or seq == []:
return 0
elif seq[-1] < x:
return len(seq)
newseq = list(seq)
sortlist = []
while x not in sortlist and newseq:
start = newseq[0]
if x <= start:
sortlist.append(x)
else:
sortlist.append(sta... | ./refactory/data/question_1/code/correct/correct_1_107.py |
refactory_data_question_1_correct_1_588 | def search(x, seq):
for i in range(len(seq)):
if x <= seq[i]:
return i
else:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_588.py |
refactory_data_question_1_correct_1_634 | def search(x, seq):
if seq == [] or seq == ():
return 0
else:
for i, elem in enumerate(seq):
if x < elem:
return i
elif x == elem:
return i
elif i == len(seq)-1:
return i+1
| ./refactory/data/question_1/code/correct/correct_1_634.py |
refactory_data_question_1_correct_1_631 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
if len(seq) == 0:
return 0
for i in range(len(seq)):
if x <= seq[i]:
return i
if x > seq[-1]:
return len(se... | ./refactory/data/question_1/code/correct/correct_1_631.py |
refactory_data_question_1_correct_1_552 | def search(x, seq):
if len(seq) == 0:
return 0
else:
for i, elem in enumerate(seq):
if x > elem and i < (len(seq)-1):
continue
elif x <= elem:
return i
else:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_552.py |
refactory_data_question_1_correct_1_744 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
i = 0
for ele in seq:
if ele>=x:
break
i += 1
return i
| ./refactory/data/question_1/code/correct/correct_1_744.py |
refactory_data_question_1_correct_1_168 | def search(x,seq):
position = tuple(enumerate(seq))
if len(seq) == 0:
return 0
else:
for i in position :
if x <= i[1]:
return i[0]
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_168.py |
refactory_data_question_1_correct_1_303 | def search(x, seq):
n = len(seq)
if n == 0:
return 0
else:
for counter in range(n):
if x > seq[n-1]:
result = n
break
elif seq[counter] >= x:
result = counter
break
else:
conti... | ./refactory/data/question_1/code/correct/correct_1_303.py |
refactory_data_question_1_correct_1_499 | def search(key, seq):
lst = list(seq)
n = len(lst)
for i in range(n+1): #0,1,2,3
if i <= n-1 and key <= lst[i]:
return i
return n
| ./refactory/data/question_1/code/correct/correct_1_499.py |
refactory_data_question_1_correct_1_343 | def search(x, seq):
count = 0
for i in seq:
if x > i:
count += 1
return count
| ./refactory/data/question_1/code/correct/correct_1_343.py |
refactory_data_question_1_correct_1_294 | def search(x, seq):
r=0
for i in seq:
if x>i:
r+=1
return r
| ./refactory/data/question_1/code/correct/correct_1_294.py |
refactory_data_question_1_correct_1_480 | def search(x, seq):
n = len(seq)
for i in range(n):
next_element = seq[i]
if x <= next_element:
return i
return n
| ./refactory/data/question_1/code/correct/correct_1_480.py |
refactory_data_question_1_correct_1_387 | def search(x, seq):
if seq == [] or seq == ():
return 0
if x <= seq[0]:
position = 0
if x >= seq[len(seq) - 1]:
position = len(seq)
for i in range(len(seq)):
if x <= seq[i] and x > seq[i-1]:
position = i
return position
| ./refactory/data/question_1/code/correct/correct_1_387.py |
refactory_data_question_1_correct_1_282 | def search(x, seq):
for a, i in enumerate(seq):
if x <= i:
return a
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_282.py |
refactory_data_question_1_correct_1_316 | def search(x, seq):
for i, elem in enumerate(seq):
if elem == x:
return i
elif x > elem:
continue
elif x < elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_316.py |
refactory_data_question_1_correct_1_663 | def search(x, seq):
index=0
for i in seq:
if x>i:
index += 1
else:
break
return index
| ./refactory/data/question_1/code/correct/correct_1_663.py |
refactory_data_question_1_correct_1_278 | def search(x, seq):
n=[]
seq = list(seq)
a= seq.copy()
d = 0
if seq == []:
return 0
for i in a:
if i<x:
n.append(i)
seq.remove(i)
elif i == x:
n.append(i)
n.append(x)
n.extend(seq)
break
... | ./refactory/data/question_1/code/correct/correct_1_278.py |
refactory_data_question_1_correct_1_070 | def search(x, seq):
a = len(seq)
if a == 0:
return 0
if a !=0 and x < seq[0]:
return 0
elif a != 0 and x > seq[-1]:
return a
else:
for i in range(a):
if x == seq[i]:
return i
elif x < seq[i]:
return i
| ./refactory/data/question_1/code/correct/correct_1_070.py |
refactory_data_question_1_correct_1_593 | def search(x, seq):
if len(seq)==0:
return 0
else:
for i,elem in enumerate(seq):
if elem>=x:
return i
elif i+1==len(seq):
return len(seq)
else:
continue
| ./refactory/data/question_1/code/correct/correct_1_593.py |
refactory_data_question_1_correct_1_073 | def search(x,seq):
counter=0
y=len(seq)
while counter<y:
if x>seq[counter]:
counter+=1
continue
break
return counter
| ./refactory/data/question_1/code/correct/correct_1_073.py |
refactory_data_question_1_correct_1_346 | def search(x, seq):
count = 0
for i in seq:
if x > i:
count += 1
return count
| ./refactory/data/question_1/code/correct/correct_1_346.py |
refactory_data_question_1_correct_1_671 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
if len(seq) == 0:
return 0
else:
index = -1
for i in seq:
if x <= i:
index += 1
... | ./refactory/data/question_1/code/correct/correct_1_671.py |
refactory_data_question_1_correct_1_292 | def search(x, seq):
a = len(seq)
for i, elem in enumerate(seq):
if x <= elem:
return i
return a
| ./refactory/data/question_1/code/correct/correct_1_292.py |
refactory_data_question_1_correct_1_515 | def search(x, seq):
counter = 0
if len(seq) == 0:
return 0
else:
for counter in range(len(seq)):
if x <= seq[counter]:
return counter
elif x > seq[counter] and counter == len(seq) - 1:
return len(seq)
elif x > seq[counter]:
... | ./refactory/data/question_1/code/correct/correct_1_515.py |
refactory_data_question_1_correct_1_358 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
counter = 0
for i in seq:
if x < i:
return counter
elif x == i:
return counter
else:
co... | ./refactory/data/question_1/code/correct/correct_1_358.py |
refactory_data_question_1_correct_1_121 |
def search(x, seq):
for i in range(len(seq)):
if x<=seq[i]:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_121.py |
refactory_data_question_1_correct_1_423 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
for i in range(len(seq)):
if seq[i] >= x:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_423.py |
refactory_data_question_1_correct_1_408 |
def search(x, seq):
if seq==():
return 0
elif seq==[]:
return 0
else:
pos=0
for i, elem in enumerate(seq):
if elem >= x:
return i
return i+1
| ./refactory/data/question_1/code/correct/correct_1_408.py |
refactory_data_question_1_correct_1_156 | def search(x, seq):
if len(seq)==0:
return 0
for i in range(len(seq)):
if x<=seq[i]:break
if i==len(seq)-1: i+=1
return i
| ./refactory/data/question_1/code/correct/correct_1_156.py |
refactory_data_question_1_correct_1_401 | def search(x, seq):
lenth=len(seq)
for i in range(0,lenth):
if x>seq[i]:
continue
else:
return i
return lenth
| ./refactory/data/question_1/code/correct/correct_1_401.py |
refactory_data_question_1_correct_1_643 | def search(x, seq):
position = 0
for i in seq:
if x > i:
position = seq.index(i) + 1
else:
position = seq.index(i)
break
return position
| ./refactory/data/question_1/code/correct/correct_1_643.py |
refactory_data_question_1_correct_1_355 | def search(x, seq):
if seq == () or seq == []:
return 0
else:
for i, elem in enumerate(seq):
if x <= elem:
return i
elif i == len(seq) - 1 and x > elem:
return i + 1
| ./refactory/data/question_1/code/correct/correct_1_355.py |
refactory_data_question_1_correct_1_284 | def search(x, seq):
for i,elem in enumerate(seq):
if x<=elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_284.py |
refactory_data_question_1_correct_1_584 | def search(x, seq):
for i, elem in enumerate (seq):
if x <= elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_584.py |
refactory_data_question_1_correct_1_216 | def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
if seq == () or seq == [] or x <= seq[0]:
return 0
elif x > seq[-1]:
return len(seq)
else:
for i,j in enumerate(seq[:le... | ./refactory/data/question_1/code/correct/correct_1_216.py |
refactory_data_question_1_correct_1_500 | def search(x, seq):
for i in range(len(seq)):
if x<= seq[i]:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_500.py |
refactory_data_question_1_correct_1_606 | def search(x,seq):
counter = 0
for i in seq:
if i < x:
counter = counter + 1
return counter
| ./refactory/data/question_1/code/correct/correct_1_606.py |
refactory_data_question_1_correct_1_111 | def search(x, seq):
listseq=list(seq)
n=len(seq)
for i in listseq:
if x<=i:
return listseq.index(i)
return n
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
| ./refactory/data/question_1/code/correct/correct_1_111.py |
refactory_data_question_1_correct_1_085 |
def search(x, seq):
new_seq=list(seq)
new_seq.append(x)
sort=[]
while new_seq:
smallest=new_seq[0]
for element in new_seq:
if element<smallest:
smallest=element
new_seq.remove(smallest)
sort.append(smallest)
for i,elem in enumerate(sort):
... | ./refactory/data/question_1/code/correct/correct_1_085.py |
refactory_data_question_1_correct_1_449 | def search(x, seq):
for i in range(len(seq)):
if x<= seq[i]:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_449.py |
refactory_data_question_1_correct_1_225 | def search(x, seq):
for i, elem in enumerate(seq):
if elem >= x:
return i #return the position of elem
return len(seq) #if x > the largest value of seq, return the last position (len(seq))
| ./refactory/data/question_1/code/correct/correct_1_225.py |
refactory_data_question_1_correct_1_674 | def search(x, seq):
for i in range(len(seq)):
if seq[i] >= x:
return i
return len(seq)
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
| ./refactory/data/question_1/code/correct/correct_1_674.py |
refactory_data_question_1_correct_1_514 | def search(x, seq):
counter = 0
if len(seq) == 0:
return 0
else:
for counter in range(len(seq)):
if x <= seq[counter]:
return counter
elif x > seq[counter] and counter == len(seq) - 1:
return len(seq)
elif x > seq[counter]:
... | ./refactory/data/question_1/code/correct/correct_1_514.py |
refactory_data_question_1_correct_1_649 | def search(x, seq):
position = 0
for elem in seq:
if x <= elem:
break
position += 1
return position
| ./refactory/data/question_1/code/correct/correct_1_649.py |
refactory_data_question_1_correct_1_147 | def search(x, seq):
for i, elem in enumerate(seq):
if x <= elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_147.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.