id stringlengths 35 39 | content stringlengths 44 3.85k | max_stars_repo_path stringlengths 52 57 |
|---|---|---|
refactory_data_question_1_wrong_1_190 | def search(x, seq):
n = len(seq)
for counter in range(n):
if x > seq[n-1]:
result = n
break
elif seq[counter] >= x:
result = counter
break
else:
continue
return result
| ./refactory/data/question_1/code/wrong/wrong_1_190.py |
refactory_data_question_1_wrong_1_351 | 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, p in enumerate(seq):
if x < p:
return i
return len(seq)
| ./refactory/data/question_1/code/wrong/wrong_1_351.py |
refactory_data_question_1_wrong_1_303 | def search(x,seq):
for i in range(len(seq)):
if len(seq) == 0:
return 0
elif x > max(seq):
return len(seq)
elif x > seq[i]:
continue
elif x <= seq[i]:
break
return i
| ./refactory/data/question_1/code/wrong/wrong_1_303.py |
refactory_data_question_1_wrong_1_443 | def search(x, seq):
if len(seq)==0:
pass
for i in range(len(seq)):
if x<=seq[i]:
return i
return i+1
| ./refactory/data/question_1/code/wrong/wrong_1_443.py |
refactory_data_question_1_wrong_1_298 | def search(x,seq):
for i in range(len(seq)):
if x > seq[i]:
continue
elif x <= seq[i]:
break
elif x > max(seq):
return len(seq)
return i
| ./refactory/data/question_1/code/wrong/wrong_1_298.py |
refactory_data_question_1_wrong_1_125 | def search(x, seq):
if len(seq) == 0:
return 0
elif x >= seq[-1]:
return len(seq)
else:
for i, elem in enumerate(seq):
if elem >= x:
return i
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that t... | ./refactory/data/question_1/code/wrong/wrong_1_125.py |
refactory_data_question_1_wrong_1_431 | def search(x, seq):
for i,elem in enumerate(seq):
if len(seq)==0:
return 0
elif elem>=x:
return i
elif i+1==len(seq):
return len(seq)
else:
continue
| ./refactory/data/question_1/code/wrong/wrong_1_431.py |
refactory_data_question_1_wrong_1_402 | def search(x, seq):
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/wrong/wrong_1_402.py |
refactory_data_question_1_wrong_1_518 | def search(x, seq):
if seq == () or []:
return 0
for c,value in enumerate(seq):
if value>=x:
return(c)
else:
return(c+1)
| ./refactory/data/question_1/code/wrong/wrong_1_518.py |
refactory_data_question_1_wrong_1_072 | def search(x, seq):
if len(seq) == 0:
return 0
elif x >= seq[-1]:
return len(seq)
else:
for i, elem in enumerate(seq):
if elem >= x:
return i
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that t... | ./refactory/data/question_1/code/wrong/wrong_1_072.py |
refactory_data_question_1_wrong_1_191 | def search(x, seq):
count==0
while count<len(seq):
if x>seq[count]:
count+=1
continue
else:
return count-1
break
return len(seq)
| ./refactory/data/question_1/code/wrong/wrong_1_191.py |
refactory_data_question_1_wrong_1_425 | def search(x, seq):
if seq == () or []:
return 0
for i in range (len(seq)):
if x <= seq[i]:
return i
elif x > seq[len(seq)-1]:
return len(seq)
| ./refactory/data/question_1/code/wrong/wrong_1_425.py |
refactory_data_question_1_wrong_1_037 | def search(x, seq):
for i in range(1, len(seq)+1):
if x < seq[i-1]:
return i-1
elif seq[i-1]<x<seq[i]:
return i
return i
| ./refactory/data/question_1/code/wrong/wrong_1_037.py |
refactory_data_question_1_wrong_1_413 | def search(x, seq):
if x <= elem:
return i
return i + 1
| ./refactory/data/question_1/code/wrong/wrong_1_413.py |
refactory_data_question_1_wrong_1_056 | def search(x, seq):
if x > seq[-1]:
return len(seq)
else:
for num in range(len(seq)):
if x > seq[num]:
continue
elif x <= seq[num]:
return num
return 0
| ./refactory/data/question_1/code/wrong/wrong_1_056.py |
refactory_data_question_1_wrong_1_018 | def search(x, seq):
if x < seq[0]:
return 0
elif x > seq[-1]:
return len(seq)
for i, elem in enumerate(seq):
if x <= elem:
return i
| ./refactory/data/question_1/code/wrong/wrong_1_018.py |
refactory_data_question_1_wrong_1_222 | def search(x, seq):
for i in len(seq):
if x <= seq[i]:
return i
return len(seq)+1
#""" 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/wrong/wrong_1_222.py |
refactory_data_question_1_wrong_1_384 | def search(x, seq):
for i in range(len(seq)):
if seq[i] < x:
continue
elif seq[len(seq)-1] < x:
return len(seq)-1
else:
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 r... | ./refactory/data/question_1/code/wrong/wrong_1_384.py |
refactory_data_question_1_wrong_1_147 | #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(val,seq):
if val <= seq[0]:
position = 0
elif val >= seq[-1]:
position = len(seq)
else:
fo... | ./refactory/data/question_1/code/wrong/wrong_1_147.py |
refactory_data_question_1_wrong_1_136 | def search(x, seq):
for i,elem in enumerate(seq):
if elem==x:
return i
| ./refactory/data/question_1/code/wrong/wrong_1_136.py |
refactory_data_question_1_wrong_1_557 | def search(x, seq):
for i,elem in enumerate(seq):
if elem<x:
pos=i+1
elif elem>x:
pos=i
return pos
| ./refactory/data/question_1/code/wrong/wrong_1_557.py |
refactory_data_question_1_wrong_1_178 | def search(x, seq):
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/wrong/wrong_1_178.py |
refactory_data_question_1_wrong_1_564 | def search(x, seq):
for i, elem in enumerate(seq):
if x <= elem:
return i
elif i == (len(seq)-1):
return i+1
else:
continue
| ./refactory/data/question_1/code/wrong/wrong_1_564.py |
refactory_data_question_1_wrong_1_010 | def search(x, seq):
for i, elem in enumerate(seq):
if elem <= x <= elem + 1:
return i
| ./refactory/data/question_1/code/wrong/wrong_1_010.py |
refactory_data_question_1_wrong_1_376 | def search(x, seq):
for i in range(len(seq)):
if seq[i] < x:
continue
else:
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 """
| ./refactory/data/question_1/code/wrong/wrong_1_376.py |
refactory_data_question_1_wrong_1_117 | def search(x, seq):
if x >= seq[-1]:
return len(seq)
else:
for i, elem in enumerate(seq):
if elem >= x:
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... | ./refactory/data/question_1/code/wrong/wrong_1_117.py |
refactory_data_question_1_wrong_1_058 | def search(x, seq):
if seq == () or []:
return 0
elif x > seq[-1]:
return len(seq)
else:
for num in range(len(seq)):
if x > seq[num]:
continue
elif x <= seq[num]:
return num
return 0
| ./refactory/data/question_1/code/wrong/wrong_1_058.py |
refactory_data_question_1_wrong_1_459 | def search(x, seq):
for i in range(len(seq)):
if seq[i] >= x:
return i
continue
else:
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/wrong/wrong_1_459.py |
refactory_data_question_1_wrong_1_324 | def search(x, seq):
for i, elem in enumerate(seq):
if seq == ():
return 0
if x <= elem:
return i
elif x > max(seq):
return len(seq)
""" Takes in a value x and a sorted sequence seq, and returns the
position th... | ./refactory/data/question_1/code/wrong/wrong_1_324.py |
refactory_data_question_1_wrong_1_243 | 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 seq:
if x <= seq[i]:
return i
| ./refactory/data/question_1/code/wrong/wrong_1_243.py |
refactory_data_question_1_wrong_1_084 | def search(x, seq):
if x <= seq[0]:
return 0
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/wrong/wrong_1_084.py |
refactory_data_question_1_wrong_1_081 | 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
| ./refactory/data/question_1/code/wrong/wrong_1_081.py |
refactory_data_question_1_wrong_1_164 | def search(x, seq):
if len(seq)==0:
return 0
for i in range(len(seq)-1):
if x<=seq[0]:
return 0
if seq[i]<=x<=seq[i+1]:
return i+1
if x>=seq[-1]:
return len(seq)
| ./refactory/data/question_1/code/wrong/wrong_1_164.py |
refactory_data_question_1_wrong_1_377 | def search(x, seq):
lst1 = list(seq)
if lst1 == []:
i = 0
else:
length = len(lst1)
lst2 = []
if x < seq[0]:
lst2 = [x] + lst1
elif x > seq[length -1]:
lst2 = lst1 + [x]
else:
for i in range(0, length):
if se... | ./refactory/data/question_1/code/wrong/wrong_1_377.py |
refactory_data_question_1_wrong_1_281 | def search(x, seq):
for i in range(0, len(seq) + 1):
if ((x < seq[0]) or (seq == ())):
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/wrong/wrong_1_281.py |
refactory_data_question_1_wrong_1_530 | def search(x, seq):
length = len(seq)
for i, elem in enumerate(seq):
if x <= elem:
return i
elif i == length-1:
return length
| ./refactory/data/question_1/code/wrong/wrong_1_530.py |
refactory_data_question_1_wrong_1_316 | def search(x, seq):
for i, ele in enumerate(seq, 0):
if x > ele:
i += 1
else:
break
return i
| ./refactory/data/question_1/code/wrong/wrong_1_316.py |
refactory_data_question_1_wrong_1_375 | def search(x, seq):
for i in len(seq):
if seq[i] < x:
continue
else:
return int(i-1)
""" 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/wrong/wrong_1_375.py |
refactory_data_question_1_wrong_1_446 | def search(x, seq):
y = len(seq)
if y == 0:
return 1
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/wrong/wrong_1_446.py |
refactory_data_question_1_wrong_1_227 | def search(x, seq):
result = None
""" 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:
result = i
break
else:
... | ./refactory/data/question_1/code/wrong/wrong_1_227.py |
refactory_data_question_1_wrong_1_490 | def search(x, seq):
l=len(seq)
for i in range(l):
if x<=seq[i]:
break
if i==l-1:
i=i+1
return i
| ./refactory/data/question_1/code/wrong/wrong_1_490.py |
refactory_data_question_1_wrong_1_087 | def search(x, seq):
if seq == () or seq == []:
return 0
else:
count = 0
for i in range (0, len(seq)):
if seq[count] < x:
count += 1
return count if seq[-1] > x else len(seq)
| ./refactory/data/question_1/code/wrong/wrong_1_087.py |
refactory_data_question_1_wrong_1_568 | def search(x, seq):
for eleme in seq:
if x <= ele:
break
position += 1
return position
| ./refactory/data/question_1/code/wrong/wrong_1_568.py |
refactory_data_question_1_wrong_1_417 | def search(x, seq):
if seq == () :
return 0
for i, elem in enumerate(seq) :
if x <= elem :
return i
return i + 1
| ./refactory/data/question_1/code/wrong/wrong_1_417.py |
refactory_data_question_1_wrong_1_277 | def search(x, seq):
t = 0
for i in seq:
if x >= i:
t+=1
return t
| ./refactory/data/question_1/code/wrong/wrong_1_277.py |
refactory_data_question_1_wrong_1_337 | def search(x, seq):
for i, elem in enumerate(seq):
if x<elem:
return i
return len(seq)
| ./refactory/data/question_1/code/wrong/wrong_1_337.py |
refactory_data_question_1_wrong_1_416 | def search(x, seq):
for i, elem in enumerate(seq) :
if x <= elem :
return i
return i + 1
| ./refactory/data/question_1/code/wrong/wrong_1_416.py |
refactory_data_question_1_wrong_1_213 | def search(x, seq):
index = 0
def helper(index):
if not seq:
return 0
elif x <= seq[index]:
return index
else:
if index + 1 >= len(seq):
return index + 1
else:
return helper(index+1)
| ./refactory/data/question_1/code/wrong/wrong_1_213.py |
refactory_data_question_1_wrong_1_477 | def search(x, seq):
if seq == () or []:
return 0
else:
for i, element in enumerate(seq):
for element in seq:
if x > element:
i+=1
return i
| ./refactory/data/question_1/code/wrong/wrong_1_477.py |
refactory_data_question_1_wrong_1_526 | def search(x, seq):
if seq == ():
return None
for i, elem in enumerate(seq):
if x <= elem:
return i
return i+1
| ./refactory/data/question_1/code/wrong/wrong_1_526.py |
refactory_data_question_1_wrong_1_174 | def search(x, seq):
if list(seq) == ():
return 0
else:
for element in seq:
if x <= element:
return list(seq).index(element)
elif x >= max(seq):
return (list(seq).index(max(seq)))+1
| ./refactory/data/question_1/code/wrong/wrong_1_174.py |
refactory_data_question_1_wrong_1_036 | def search(x, seq):
for i in range(1, len(seq)+1):
if x < seq[i-1]:
return i-1
elif seq[i-1]<x<seq[i]:
return i
else:
return i-1
| ./refactory/data/question_1/code/wrong/wrong_1_036.py |
refactory_data_question_1_wrong_1_248 | def search(x, seq):
if x <= seq[0]:
position = 0
for i in range(len(seq)):
if x <= seq[i] and x >= seq[i-1]:
position = i
return position
| ./refactory/data/question_1/code/wrong/wrong_1_248.py |
refactory_data_question_1_wrong_1_403 | def search(x, seq):
n = len(seq)
if seq ==():
return 0
for i in range(0,n):
currentvalue = seq[i]
position = i
if position >= 0 and x>currentvalue:
position = i+1
elif position >= 0 and x<= currentvalue:
return position
return position
| ./refactory/data/question_1/code/wrong/wrong_1_403.py |
refactory_data_question_1_wrong_1_505 | def search(x, seq):
i = 0
while (i<len(seq) and x<seq[i]):
i += 1
return i
| ./refactory/data/question_1/code/wrong/wrong_1_505.py |
refactory_data_question_1_wrong_1_334 | 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/wrong/wrong_1_334.py |
refactory_data_question_1_wrong_1_515 | def search(x, seq):
if int(x) < seq[0]:
return 0
elif int(x)> seq[len(seq)-1]:
return len(seq)
Index = 0
for i in range(0,len(seq)):
if int(x)>seq[i]:
continue
Index = i
return Index
| ./refactory/data/question_1/code/wrong/wrong_1_515.py |
refactory_data_question_1_wrong_1_307 | def search(x, seq):
n = len(seq)
if seq: #if seq is not an empty list/tuple
for i in range(n):
next_element = seq[i]
if x <= next_element:
return i
return n
| ./refactory/data/question_1/code/wrong/wrong_1_307.py |
refactory_data_question_1_wrong_1_359 | def search(x, seq):
if x <= seq[0]:
return 0
elif x >= seq[-1]:
return len(seq)
elif seq == ():
return 0
else:
for i in range(0, len(seq)-1):
if seq[i] <= x <= seq[i+1]:
return i+1
| ./refactory/data/question_1/code/wrong/wrong_1_359.py |
refactory_data_question_1_wrong_1_419 | def search(x, seq):
for i in range(len(seq)-1):
if x <= seq[i+1]:
break
return i
| ./refactory/data/question_1/code/wrong/wrong_1_419.py |
refactory_data_question_1_wrong_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 """
counter = -1
for i in seq:
if x <= i:
counter += 1
return counter
elif x > i:
counter += 1
... | ./refactory/data/question_1/code/wrong/wrong_1_522.py |
refactory_data_question_1_wrong_1_065 | def search(x, seq):
for i in range(0,len(seq)):
if x<seq[i]:
return print(i)
else:
return print(len(seq))
| ./refactory/data/question_1/code/wrong/wrong_1_065.py |
refactory_data_question_1_wrong_1_437 | def search(x,seq):
if type(seq) == tuple:
tup = ()
for i in seq:
if i < x:
tup = tup + (i,)
else:
tup = tup + (x,)
break
return len(tup) - 1
elif type(seq) == list:
lst = []
for i in seq:
... | ./refactory/data/question_1/code/wrong/wrong_1_437.py |
refactory_data_question_1_wrong_1_408 | def search(x, seq):
for i in seq:
if x <= i:
return seq.index(i)
elif x > seq[-1]:
return (seq.index(seq[-1])) + 1
elif seq == () or seq == []:
return 0
| ./refactory/data/question_1/code/wrong/wrong_1_408.py |
refactory_data_question_1_wrong_1_142 | def search(x, seq):
n=[]
seq = list(seq)
a= seq.copy()
d = 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
else:
n.append(x)
... | ./refactory/data/question_1/code/wrong/wrong_1_142.py |
refactory_data_question_1_wrong_1_390 | def search(x, seq):
lst1 = list(seq)
if len(lst1) == 0:
return 0
else:
length = len(lst1)
lst2 = []
if x < seq[0]:
lst2 = [x] + lst1
elif x > seq[length -1]:
lst2 = lst1 + [x]
else:
for i in range(0, length):
... | ./refactory/data/question_1/code/wrong/wrong_1_390.py |
refactory_data_question_1_wrong_1_121 | def search(x, seq):
if len(seq) == 0:
return 0
elif x >= seq[-1]:
return len(seq)
else:
for i, elem in enumerate(seq):
if elem >= x:
return i
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that t... | ./refactory/data/question_1/code/wrong/wrong_1_121.py |
refactory_data_question_1_wrong_1_343 | def search(x, seq):
for i in range(len(seq)):
if seq == [] or ():
return 0
elif x > seq[-1]:
return len(seq)
elif x == seq[i]:
return i
elif x < seq[i]:
return i
| ./refactory/data/question_1/code/wrong/wrong_1_343.py |
refactory_data_question_1_wrong_1_004 | def search(x, seq):
if x < seq[0]:
return 0
elif x > seq[-1]:
return len(seq)
else:
seq_enum = [i for i in enumerate(seq)]
for j in range(len(seq_enum) - 1):
if x >= seq_enum[j][1] and x <= seq_enum[j+1][1]:
return j+1
| ./refactory/data/question_1/code/wrong/wrong_1_004.py |
refactory_data_question_1_wrong_1_346 | def search(x, seq):
if seq == () or []:
return 0
for i in range(len(seq)):
if x > seq[-1]:
return len(seq)
elif x == seq[i]:
return i
elif x < seq[i]:
return i
| ./refactory/data/question_1/code/wrong/wrong_1_346.py |
refactory_data_question_1_wrong_1_225 | def search(x, seq):
for i in range(len(seq)):
if x <= seq[i]:
return i
return len(seq)+1
#""" 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/wrong/wrong_1_225.py |
refactory_data_question_1_wrong_1_322 | def search(x, seq):
for i, elem in enumerate(seq):
if x <= elem:
return i
elif x > max(seq):
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 re... | ./refactory/data/question_1/code/wrong/wrong_1_322.py |
refactory_data_question_1_wrong_1_260 | 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 i
| ./refactory/data/question_1/code/wrong/wrong_1_260.py |
refactory_data_question_1_wrong_1_544 | def search(x, seq):
if len(seq) == 0:
indx = 0
else:
if x < seq[0]:
indx = 0
elif x > seq[-1]:
indx = seq.index(seq[-1]) + 1
else:
for i in seq:
if x <= i:
indx = (seq.index(i))
break ... | ./refactory/data/question_1/code/wrong/wrong_1_544.py |
refactory_data_question_1_wrong_1_474 | def search(x, seq):
if seq == () or []:
return 0
else:
for i, element in enumerate(seq):
for element in seq:
if x > element:
i+=1
return i
| ./refactory/data/question_1/code/wrong/wrong_1_474.py |
refactory_data_question_1_wrong_1_177 | def search(x, seq):
if list(seq) == []:
return 0
else:
for element in seq:
if x <= element:
return list(seq).index(element)
elif x >= max(seq):
return (list(seq).index(max(seq)))+1
| ./refactory/data/question_1/code/wrong/wrong_1_177.py |
refactory_data_question_1_wrong_1_371 | def search(x, seq):
lst1 = list(seq)
if lst1 == []:
return 0
else:
length = len(lst1)
lst2 = []
if x < seq[0]:
lst2 = [x] + lst1
elif x > seq[length -1]:
lst2 = lst1 + [x]
else:
for i in range(0, length):
if... | ./refactory/data/question_1/code/wrong/wrong_1_371.py |
refactory_data_question_1_wrong_1_366 | 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/wrong/wrong_1_366.py |
refactory_data_question_1_wrong_1_097 | 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 x<=seq[0]:
return 0
elif x>seq[-1]:
return len(seq)
else:
for i,elem in enumerate(seq):
if x>... | ./refactory/data/question_1/code/wrong/wrong_1_097.py |
refactory_data_question_1_wrong_1_070 | def search(x, seq):
for i in range(0,len(seq)):
if len(seq)==0:
return False
elif x<seq[i]:
return i
elif x==seq[i]:
return i
elif x>seq[len(seq)-1]:
return len(seq)
| ./refactory/data/question_1/code/wrong/wrong_1_070.py |
refactory_data_question_1_wrong_1_534 | def search(x, seq):
for i, elem in enumerate(seq):
if x <= elem:
return i
else:
return len(seq)
| ./refactory/data/question_1/code/wrong/wrong_1_534.py |
refactory_data_question_1_wrong_1_237 | def search(x, seq):
if x <= seq[-1]:
for i in range(len(seq)):
if seq[i] < x:
continue
else:
return i
else:
return len(seq)
| ./refactory/data/question_1/code/wrong/wrong_1_237.py |
refactory_data_question_1_wrong_1_139 | def search(x, seq):
for i,elem in enumerate(seq):
if x > elem:
continue
return i
return i+1
| ./refactory/data/question_1/code/wrong/wrong_1_139.py |
refactory_data_question_1_wrong_1_234 | def search(x, seq):
for i, elem in enumerate(seq):
if x <= elem:
return i
return i+1
| ./refactory/data/question_1/code/wrong/wrong_1_234.py |
refactory_data_question_1_wrong_1_386 | def search(x, seq):
for i in range(len(seq)):
if seq[i] < x:
continue
elif x <= seq[i]:
return i
else:
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 sor... | ./refactory/data/question_1/code/wrong/wrong_1_386.py |
refactory_data_question_1_wrong_1_166 | def search(x, seq):
if len(seq)==0:
return 0
if len(seq)==1:
if x>=seq[0]:
return 1
elif x<seq[0]:
return 0
for i in range(len(seq)-1):
if x<=seq[0]:
return 0
if seq[i]<=x<=seq[i+1]:
return i+1
if x>=seq[-1]:
... | ./refactory/data/question_1/code/wrong/wrong_1_166.py |
refactory_data_question_1_wrong_1_485 | def search(x, seq):
result = 0
for i in range(len(seq)):
if seq[i] > x:
result = i
break
return result
| ./refactory/data/question_1/code/wrong/wrong_1_485.py |
refactory_data_question_1_wrong_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 x<=seq[0]:
return 0
if x>seq[-1]:
return len(seq)
else:
for i,elem in enumerate(seq):
if x>elem and x<=s... | ./refactory/data/question_1/code/wrong/wrong_1_093.py |
refactory_data_question_1_wrong_1_372 | def search(x, seq):
lst1 = list(seq)
if lst1 == []:
return 0
else:
length = len(lst1)
lst2 = []
if x < seq[0]:
lst2 = [x] + lst1
elif x > seq[length -1]:
lst2 = lst1 + [x]
else:
for i in range(0, length):
if... | ./refactory/data/question_1/code/wrong/wrong_1_372.py |
refactory_data_question_1_wrong_1_272 | 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(enumerate(seq))
if x > max(seq):
return len(seq)
else:
for i in range(len(enumerated)):
if enumer... | ./refactory/data/question_1/code/wrong/wrong_1_272.py |
refactory_data_question_1_wrong_1_574 | 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
if x < seq[0]:
return 0
elif x > seq[len(seq)-1]:
return len(seq)
else:
... | ./refactory/data/question_1/code/wrong/wrong_1_574.py |
refactory_data_question_1_wrong_1_168 | def search(x, seq):
for element in seq:
if x <= element:
return list(seq).index(element)
else:
continue
| ./refactory/data/question_1/code/wrong/wrong_1_168.py |
refactory_data_question_1_wrong_1_052 | def search(x, seq):
if seq == () or seq == []:
return 0
elif newseq[-1] < x:
return len(newseq)
newseq = list(seq)
sortlist = []
while x not in sortlist and newseq:
start = newseq[0]
if x <= start:
sortlist.append(x)
else:
sortlist... | ./refactory/data/question_1/code/wrong/wrong_1_052.py |
refactory_data_question_1_wrong_1_020 | def search(x, seq):
if x < seq[0]:
return 0
elif x > seq[-1]:
return len(seq)
elif seq == ():
return None
for i, elem in enumerate(seq):
if x <= elem:
return i
| ./refactory/data/question_1/code/wrong/wrong_1_020.py |
refactory_data_question_1_wrong_1_364 | 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 range(0, len(seq)-1):
if seq[i] <= x <= seq[i+1]:
return i+1
| ./refactory/data/question_1/code/wrong/wrong_1_364.py |
refactory_data_question_1_wrong_1_434 | def search2(x,seq):
for i,elem in enumerate(seq):
counter = 0
if x<= elem:
counter = i
else:
counter = len(seq)
return counter
| ./refactory/data/question_1/code/wrong/wrong_1_434.py |
refactory_data_question_1_wrong_1_205 | def search(x, seq):
for i in range(len(seq) - 1):
if seq[i] < x < seq[i+1]:
return i+1
| ./refactory/data/question_1/code/wrong/wrong_1_205.py |
refactory_data_question_1_wrong_1_498 | 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 """
seq = tuple(seq)
if x == () or x == []:
return None
elif x > seq[len(seq)-1]:
return len(seq)
else:
i = 0
w... | ./refactory/data/question_1/code/wrong/wrong_1_498.py |
refactory_data_question_1_wrong_1_229 | def search(x, seq):
if x <= seq[0]:
return 0
elif x >= seq[len(seq)-1]:
return len(seq)
else:
for i, elem in enumerate(seq):
if elem <= x <= seq[i+1]:
return i+1
| ./refactory/data/question_1/code/wrong/wrong_1_229.py |
refactory_data_question_1_wrong_1_306 | def search(x, seq):
if seq==[]or():
return 0
for i,v in enumerate(seq):
if x>v and i!=len(seq)-1:
continue
elif x>v and i==len(seq)-1:
return i+1
else:
break
return i
| ./refactory/data/question_1/code/wrong/wrong_1_306.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.