id stringlengths 35 39 | content stringlengths 44 3.85k | max_stars_repo_path stringlengths 52 57 |
|---|---|---|
refactory_data_question_1_correct_1_471 | def search(x, seq):
for i,elem in enumerate(seq):
if x<=elem:
return i
""" 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 len(seq)
| ./refactory/data/question_1/code/correct/correct_1_471.py |
refactory_data_question_1_correct_1_741 | def search(x, seq):
new_lst = []
if len(seq) == 0:
return 0
for i, elem in enumerate(seq):
new_lst.append((i, elem))
for i in new_lst:
if x <= i[1]:
return i[0]
else:
continue
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_741.py |
refactory_data_question_1_correct_1_496 | def search(x, seq):
if seq==[]:
return 0
for i,element in enumerate(seq):
if x<=element:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_496.py |
refactory_data_question_1_correct_1_188 | 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_188.py |
refactory_data_question_1_correct_1_652 | def search(x, seq):
if seq == () or seq == []:
return 0
else:
for i, elem in enumerate (seq):
if x<=elem:
return i
elif x>seq[-1]:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_652.py |
refactory_data_question_1_correct_1_419 | 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_419.py |
refactory_data_question_1_correct_1_604 | 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 """
a = 0
for i in seq:
if i<x:
a += 1
else:
break
return a
| ./refactory/data/question_1/code/correct/correct_1_604.py |
refactory_data_question_1_correct_1_706 | def search(x, seq):
if seq==[] or seq==():
return 0
else:
for i in range(len(seq)):
if i <range(len(seq))[-1]:
if x<=seq[i]:
return i
break
else:
continue
else:
if ... | ./refactory/data/question_1/code/correct/correct_1_706.py |
refactory_data_question_1_correct_1_233 | def search(x, seq):
if not seq:
return 0
elif x <= seq[0]:
return 0
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_233.py |
refactory_data_question_1_correct_1_679 | def search(x, seq):
c = 0
""" 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 seq:
if x > i:
c += 1
else:
return c
return c
| ./refactory/data/question_1/code/correct/correct_1_679.py |
refactory_data_question_1_correct_1_116 | 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
elif x < seq[0]:
return 0
elif x > seq[len(seq)-1]:
return len(seq)
counter = 0
for ... | ./refactory/data/question_1/code/correct/correct_1_116.py |
refactory_data_question_1_correct_1_077 | def search(x, seq):
if seq == () or seq == []:
return 0
else:
for i, elem in enumerate(seq):
if x <= elem:
return i
elif x > seq[-1]:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_077.py |
refactory_data_question_1_correct_1_198 | 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_198.py |
refactory_data_question_1_correct_1_279 | 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_279.py |
refactory_data_question_1_correct_1_488 | def search(x, seq):
if not seq:
return 0
else:
for i in range(len(seq)):
if x<=seq[i]:
return i
return i+1
| ./refactory/data/question_1/code/correct/correct_1_488.py |
refactory_data_question_1_correct_1_064 | def search(x, seq):
if len(seq) == 0:
return 0
elif x < int(seq[0]):
return 0
elif x > int(seq[len(seq)-1]):
return len(seq)
else:
for i in range(len(seq)):
if x > seq[i] and x <= seq[i+1]:
return i+1
| ./refactory/data/question_1/code/correct/correct_1_064.py |
refactory_data_question_1_correct_1_250 | def search(x, seq):
a = 0
for ele in seq:
if ele < x:
a +=1
return a
| ./refactory/data/question_1/code/correct/correct_1_250.py |
refactory_data_question_1_correct_1_504 | 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_504.py |
refactory_data_question_1_correct_1_055 | 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_055.py |
refactory_data_question_1_correct_1_535 | 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_535.py |
refactory_data_question_1_correct_1_467 | def search(x,seq):
if len(seq) == 0:
return 0
else:
for i in range(len(seq)):
if x > max(seq):
return len(seq)
elif x > seq[i]:
continue
elif x <= seq[i]:
break
return i
| ./refactory/data/question_1/code/correct/correct_1_467.py |
refactory_data_question_1_correct_1_492 | def search(x, seq):
count=0
for i in range (len(seq)):
if x<=seq[i]:
break
count +=1
return count
| ./refactory/data/question_1/code/correct/correct_1_492.py |
refactory_data_question_1_correct_1_092 |
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
else:
for i in range(0,len(seq)):
if i == 0 and x<seq[0]:
return 0... | ./refactory/data/question_1/code/correct/correct_1_092.py |
refactory_data_question_1_correct_1_270 | def search(x, seq):
seq = list(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_270.py |
refactory_data_question_1_correct_1_711 | 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 """
lst = list(seq)
lst.append(x)
lst.sort()
tup = tuple(enumerate(lst))
for i in range(len(tup)):
if tup[i][1]==x:
ret... | ./refactory/data/question_1/code/correct/correct_1_711.py |
refactory_data_question_1_correct_1_470 | def search(x, seq):
list2 = list(enumerate(seq))
if list2 == []:
return 0
else:
for i in list2:
if x <= (i[1]):
return i[0]
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_470.py |
refactory_data_question_1_correct_1_248 | 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_248.py |
refactory_data_question_1_correct_1_568 | 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_568.py |
refactory_data_question_1_correct_1_150 | def search(x, seq):
pos=0
for i in seq:
if x<=i:
pos=seq.index(i)
return pos
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_150.py |
refactory_data_question_1_correct_1_202 | 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
else:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_202.py |
refactory_data_question_1_correct_1_620 | 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_620.py |
refactory_data_question_1_correct_1_334 | def search(x, seq):
position = 0
for i in range(len(seq)):
if x <= seq[i]:
position = i
break
else:
position = len(seq)
return position
| ./refactory/data/question_1/code/correct/correct_1_334.py |
refactory_data_question_1_correct_1_315 | 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_315.py |
refactory_data_question_1_correct_1_255 | def search(x, seq):
if seq == ():
return 0
elif seq == []:
return 0
else:
for i, elem in enumerate(seq):
if x > seq[-1]:
return len(seq)
elif x > elem:
continue
else:
return i
| ./refactory/data/question_1/code/correct/correct_1_255.py |
refactory_data_question_1_correct_1_196 | def search(x, seq):
position=enumerate(seq)
if len(seq)==0:
return 0
elif x>seq[-1]:
return len(seq)
else:
for i in seq:
if x<=i:
for index in position:
if index[1]==i:
return index[0]
| ./refactory/data/question_1/code/correct/correct_1_196.py |
refactory_data_question_1_correct_1_450 | 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_450.py |
refactory_data_question_1_correct_1_159 | 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, ele in enumerate(seq):
if x <= ele:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_159.py |
refactory_data_question_1_correct_1_415 | 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 """
enumerated_list =()
res= 0
for i, elem in enumerate(seq):
enumerated_list = enumerated_list + ((i,elem),)
for number in enumerated... | ./refactory/data/question_1/code/correct/correct_1_415.py |
refactory_data_question_1_correct_1_550 | 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_550.py |
refactory_data_question_1_correct_1_088 |
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_088.py |
refactory_data_question_1_correct_1_497 | def search(x, seq):
counter = 0
for i in seq:
if x <= i:
break
else:
counter += 1
return counter
| ./refactory/data/question_1/code/correct/correct_1_497.py |
refactory_data_question_1_correct_1_664 | 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_664.py |
refactory_data_question_1_correct_1_600 | 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_600.py |
refactory_data_question_1_correct_1_509 | def search(x, seq):
if len(seq)==0:
return 0
if x <= seq[0]:
return 0
for i in range(len(seq)-1):
if seq[i+1]>=x and x>seq[i]:
return i+1
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_509.py |
refactory_data_question_1_correct_1_587 | 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)< 1:
return 0
else:
for i in range(len(seq)):
if x <= seq[i]:
return i
else:
... | ./refactory/data/question_1/code/correct/correct_1_587.py |
refactory_data_question_1_correct_1_586 | 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)< 1:
return 0
else:
for i in range(len(seq)):
if x <= seq[i]:
return i
else:
... | ./refactory/data/question_1/code/correct/correct_1_586.py |
refactory_data_question_1_correct_1_472 | 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_472.py |
refactory_data_question_1_correct_1_208 | 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(0,len(seq)):
if seq[i] >= x:
return max(i, 0)
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_208.py |
refactory_data_question_1_correct_1_411 | def search(x, seq):
position=enumerate(seq)
if len(seq)==0:
return 0
elif x>seq[-1]:
return len(seq)
else:
for i in seq:
if x<=i:
for index in position:
if index[1]==i:
return index[0]
| ./refactory/data/question_1/code/correct/correct_1_411.py |
refactory_data_question_1_correct_1_575 | def search(x,seq):
for index in range(len(seq)):
if x <= seq[index]:
return index
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_575.py |
refactory_data_question_1_correct_1_731 | def search(x, seq):
ns = tuple(enumerate(seq))
for y in ns:
if x <= y[1]:
return y[0]
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_731.py |
refactory_data_question_1_correct_1_537 | 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_537.py |
refactory_data_question_1_correct_1_038 | 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) ==1:
if x < seq[0]:
return 0
else:
return 1
for i in range(len(seq)):
if i == 0:
... | ./refactory/data/question_1/code/correct/correct_1_038.py |
refactory_data_question_1_correct_1_157 | 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 """
pos = 0
for i in range(len(seq)):
if x <= seq[i]:
pos = i
return pos
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_157.py |
refactory_data_question_1_correct_1_093 |
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
else:
for i in range(0,len(seq)):
if i == 0 and x<seq[0]:
return 0... | ./refactory/data/question_1/code/correct/correct_1_093.py |
refactory_data_question_1_correct_1_410 | def search(x, seq):
for i, elem in enumerate((seq)):
if x > elem:
continue
else:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_410.py |
refactory_data_question_1_correct_1_179 | def search(x, seq):
counter = 0
for i in seq:
if x>i:
counter +=1 #all the element that is the smaller than x
return counter
| ./refactory/data/question_1/code/correct/correct_1_179.py |
refactory_data_question_1_correct_1_167 | def search(x, seq):
pos = len(seq)
for i, elem in enumerate(seq):
if x <= elem:
pos = i
break
return pos
| ./refactory/data/question_1/code/correct/correct_1_167.py |
refactory_data_question_1_correct_1_675 | 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_675.py |
refactory_data_question_1_correct_1_559 | def search(x, seq):
def find_index(tup,elem):
for i, j in enumerate(tup):
if j==elem:
return i
if seq==[] or seq==():
return 0
elif x<=seq[len(seq)-1]:
for i in seq:
if x<=i:
return find_index(seq,i)
elif x>seq[len(seq)-1]:
... | ./refactory/data/question_1/code/correct/correct_1_559.py |
refactory_data_question_1_correct_1_451 | 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_451.py |
refactory_data_question_1_correct_1_709 | def search(x, seq):
if not seq:
return 0
elif x < seq[0]:
return 0
else:
i = 0
while i in range(len(seq)):
if x <= seq[i]:
return i
elif x > seq[len(seq)-1]:
return len(seq)
else:
i += 1
"... | ./refactory/data/question_1/code/correct/correct_1_709.py |
refactory_data_question_1_correct_1_323 | def search(x, seq):
if type(seq) == tuple:
lst = list(seq)
else:
lst = seq
counter = 0
for i in lst:
if x <= i:
continue
else:
counter += 1
return counter
| ./refactory/data/question_1/code/correct/correct_1_323.py |
refactory_data_question_1_correct_1_133 | def search(x, seq):
for i, y in enumerate(seq):
if x <= y:
return i
if seq == [] or seq == ():
return 0
else:
return 1+i
| ./refactory/data/question_1/code/correct/correct_1_133.py |
refactory_data_question_1_correct_1_672 | def search(x, seq):
for i, ele in enumerate(seq):
if x <= ele:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_672.py |
refactory_data_question_1_correct_1_617 | def search(x, seq):
for i, elem in enumerate(seq):
if x == elem:
return i
elif x < seq[0]:
return 0
elif x < elem and x > seq[i-1]:
return i
return len(seq)
""" Takes in a value x and a sorted sequence seq, and returns the
position that x sho... | ./refactory/data/question_1/code/correct/correct_1_617.py |
refactory_data_question_1_correct_1_457 | def search(x, seq):
for i in range(0, len(seq) + 1):
if len(seq) == 0:
return 0
elif x < seq[0]:
return 0
elif seq[i] < x <= seq[i+1]:
return i + 1
elif seq[len(seq)-1] < x:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_457.py |
refactory_data_question_1_correct_1_099 | def search(x, seq):
if len(seq) == 0:
return 0
else:
for i, elem in enumerate(seq):
if i == 0 and x < elem:
return 0
elif x <= elem:
return i
elif i == len(seq) - 1:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_099.py |
refactory_data_question_1_correct_1_108 | def search(x, seq):
for i, val in enumerate(seq):
if x <= val:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_108.py |
refactory_data_question_1_correct_1_614 | def search(x, seq):
y = len(seq)
if y == 0 or x < seq[0]:
return 0
else:
for i in range(y-1):
if x > seq[i] and x <= seq[i+1]:
return i + 1
return y
| ./refactory/data/question_1/code/correct/correct_1_614.py |
refactory_data_question_1_correct_1_636 | 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_636.py |
refactory_data_question_1_correct_1_238 | def search(x, seq):
if seq==[] or seq== ():
return 0
else:
for i, elem in enumerate(seq):
if elem>=x:
return i
else:
return (i+1)
| ./refactory/data/question_1/code/correct/correct_1_238.py |
refactory_data_question_1_correct_1_598 | 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 i in seq:
if x > i:
position += 1
else:
continue
return position
| ./refactory/data/question_1/code/correct/correct_1_598.py |
refactory_data_question_1_correct_1_386 | def search(x, seq):
new = list(enumerate(seq))
for n in new:
if x <= n[1]:
return n[0]
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_386.py |
refactory_data_question_1_correct_1_193 | 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_193.py |
refactory_data_question_1_correct_1_152 | def search(x, seq):
result = 0
counter = 0
while counter < len(seq):
temp = seq[counter]
if x <= temp:
return counter
counter = counter + 1
if counter == 0 and len(seq)!= 0:
return len(seq)
return counter
| ./refactory/data/question_1/code/correct/correct_1_152.py |
refactory_data_question_1_correct_1_407 | 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_407.py |
refactory_data_question_1_correct_1_191 | 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_191.py |
refactory_data_question_1_correct_1_207 | def search(x, seq):
new_seq=[]
position=0
for i in range(len(seq)):
if x>seq[i]:
position+=1
return position
| ./refactory/data/question_1/code/correct/correct_1_207.py |
refactory_data_question_1_correct_1_235 | 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 i,e in enumerate(seq):
if x > e:
position = i+1
return position
| ./refactory/data/question_1/code/correct/correct_1_235.py |
refactory_data_question_1_correct_1_635 | def search(x, seq):
result = 0
for i in range(len(seq)):
if seq[i] >= x:
result = i
break
elif x > seq[i]:
result = i + 1
return result
| ./refactory/data/question_1/code/correct/correct_1_635.py |
refactory_data_question_1_correct_1_201 | def search(x, seq):
for i in range(len(seq)):
if seq[i] >= x:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_201.py |
refactory_data_question_1_correct_1_699 | 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_699.py |
refactory_data_question_1_correct_1_700 | def search(x, seq):
if seq == [] or seq == ():
return 0
for elem in seq:
if x < elem:
return seq.index(elem)
elif x == elem:
return seq.index(elem)
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_700.py |
refactory_data_question_1_correct_1_051 | 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_051.py |
refactory_data_question_1_correct_1_245 | def search(x, seq):
brokeloop=False
if len(seq)==0:
return 0
for i, elem in enumerate(seq):
if elem>=x:
brokeloop=True
break
if brokeloop==True:
return i
else:
return i+1
| ./refactory/data/question_1/code/correct/correct_1_245.py |
refactory_data_question_1_correct_1_028 | def search(x, seq):
counter = 0
for i in seq:
if x > i:
counter = counter + 1
return counter
| ./refactory/data/question_1/code/correct/correct_1_028.py |
refactory_data_question_1_correct_1_329 | def search(x, seq):
if seq == () or seq == []:
return 0
else:
for i, elem in enumerate (seq):
if x<=elem:
return i
elif x>seq[-1]:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_329.py |
refactory_data_question_1_correct_1_567 | 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_567.py |
refactory_data_question_1_correct_1_656 | 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_656.py |
refactory_data_question_1_correct_1_330 | def search(x, seq):
for i, elem in enumerate(seq):
if elem >= x:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_330.py |
refactory_data_question_1_correct_1_242 | def search(x, seq):
total = seq
counter = 0
while counter != len(seq):
if x <= total[counter]:
break
else:
counter += 1
return counter
| ./refactory/data/question_1/code/correct/correct_1_242.py |
refactory_data_question_1_correct_1_025 | def search(x, seq):
count=0
for i in seq:
if x<=i:
return count
else:
count+=1
return count
| ./refactory/data/question_1/code/correct/correct_1_025.py |
refactory_data_question_1_correct_1_445 | def search(x, seq):
counter=0
for i in seq:
if x<=i:
return counter
else:
counter=counter+1
return counter
| ./refactory/data/question_1/code/correct/correct_1_445.py |
refactory_data_question_1_correct_1_578 | def search(x, seq):
counter = 0
for i in seq:
if x>i:
counter +=1 #all the element that is the smaller than x
return counter
| ./refactory/data/question_1/code/correct/correct_1_578.py |
refactory_data_question_1_correct_1_522 | 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 p in seq:
if x <= p:
return i
i += 1
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_522.py |
refactory_data_question_1_correct_1_087 | def search(x, seq):
if len(seq)==0:
return 0
if x < seq[0]:
return 0
elif x > seq[len(seq)-1]:
return len(seq)
else:
for i in range(len(seq)):
if x > seq[i] and x <= seq[i+1]:
return i+1
| ./refactory/data/question_1/code/correct/correct_1_087.py |
refactory_data_question_1_correct_1_037 | def search(x,seq):
for index in range(len(seq)):
if x <= seq[index]:
return index
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_037.py |
refactory_data_question_1_correct_1_607 | 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_607.py |
refactory_data_question_1_correct_1_464 | def search(x, seq):
if len(seq) == 0:
return 0
else:
for i in range(0, len(seq)):
no = len(seq)
if x > seq[i]:
continue
elif x <= seq[i]:
no = i
break
return no
| ./refactory/data/question_1/code/correct/correct_1_464.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.