id stringlengths 35 39 | content stringlengths 44 3.85k | max_stars_repo_path stringlengths 52 57 |
|---|---|---|
refactory_data_question_1_correct_1_254 | def search(x, seq):
position = 0
for ele in seq:
if x > ele:
position = position + 1
return position
| ./refactory/data/question_1/code/correct/correct_1_254.py |
refactory_data_question_1_correct_1_427 | def search(x, seq):
if len(seq) == 0:
return 0
else:
for i in range(len(seq)):
if x < seq[0]:
pos = 0
break
elif x <= seq[i]:
pos = i
break
elif x > seq[len(seq) - 1]:
pos = len(se... | ./refactory/data/question_1/code/correct/correct_1_427.py |
refactory_data_question_1_correct_1_541 | def search(x, seq):
count = 0
for i in seq:
if x > i:
count += 1
return count
""" 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/correct/correct_1_541.py |
refactory_data_question_1_correct_1_222 | 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_222.py |
refactory_data_question_1_correct_1_274 | def search(x, seq):
counter = 0
for value in seq:
if x > value:
counter = counter + 1
else:
break
return counter
| ./refactory/data/question_1/code/correct/correct_1_274.py |
refactory_data_question_1_correct_1_426 | def search(x, seq):
t = 0
for i in seq:
if x > i:
t+=1
return t
| ./refactory/data/question_1/code/correct/correct_1_426.py |
refactory_data_question_1_correct_1_540 | 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_540.py |
refactory_data_question_1_correct_1_236 | 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_236.py |
refactory_data_question_1_correct_1_381 | 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_381.py |
refactory_data_question_1_correct_1_039 | 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_039.py |
refactory_data_question_1_correct_1_692 | 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_692.py |
refactory_data_question_1_correct_1_430 | 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_430.py |
refactory_data_question_1_correct_1_065 | def search(x, seq):
if len(seq) == 0: #if there is nothing in the sequence, put it as the first part of the column
return 0
else:
for i in range(len(seq)):
if x > seq[-1]: #if the digit x is greater than the greatest number in the sequence, return the number of elements in the se... | ./refactory/data/question_1/code/correct/correct_1_065.py |
refactory_data_question_1_correct_1_269 | 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_269.py |
refactory_data_question_1_correct_1_683 | def search(x, seq):
if seq == () or seq == []:
return 0
if x>seq[len(seq)-1]:
return len(seq)
for i in range(len(seq)):
if x>seq[i]:
continue
return i
| ./refactory/data/question_1/code/correct/correct_1_683.py |
refactory_data_question_1_correct_1_682 | 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_682.py |
refactory_data_question_1_correct_1_047 | def search(x, seq):
if len(seq)==0:
return 0
for i in range(len(seq)):
if x<=seq[i]:
return i
return i+1
| ./refactory/data/question_1/code/correct/correct_1_047.py |
refactory_data_question_1_correct_1_529 | 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_529.py |
refactory_data_question_1_correct_1_219 | def search(x, seq):
lst = list(seq)
lst.append(x)
sort = []
while lst:
smallest = lst[0]
for ele in lst:
if ele < smallest:
smallest = ele
lst.remove(smallest)
sort.append(smallest)
for i in range(len(sort)):
if sort[i] ==x:
... | ./refactory/data/question_1/code/correct/correct_1_219.py |
refactory_data_question_1_correct_1_287 | 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)
for i,elem in enumerated_list:
if x<=elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_287.py |
refactory_data_question_1_correct_1_677 | 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_677.py |
refactory_data_question_1_correct_1_266 | def search(x, seq):
output = 0
for j in seq:
if x>j:
output +=1
return output
| ./refactory/data/question_1/code/correct/correct_1_266.py |
refactory_data_question_1_correct_1_399 | def search(x, seq):
for i, e in enumerate(seq):
if x <= e:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_399.py |
refactory_data_question_1_correct_1_447 | 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_447.py |
refactory_data_question_1_correct_1_335 | 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_335.py |
refactory_data_question_1_correct_1_361 | def search(x, seq):
result = 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 """
if seq == () or seq == []:
return result
for i, elem in enumerate(seq):
if x <= elem:
result = i
... | ./refactory/data/question_1/code/correct/correct_1_361.py |
refactory_data_question_1_correct_1_376 | 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))
elif x >= max(seq):
return (list(se... | ./refactory/data/question_1/code/correct/correct_1_376.py |
refactory_data_question_1_correct_1_442 | 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_442.py |
refactory_data_question_1_correct_1_432 | def search(x, seq):
if seq == () or seq == []:
return 0
if seq[0] >= x:
return 0
elif seq[len(seq)-1] < x:
return len(seq)
else:
for i in range(len(seq)-1):
if seq[i] < x and seq[i+1] >= x:
return i+1
break
| ./refactory/data/question_1/code/correct/correct_1_432.py |
refactory_data_question_1_correct_1_613 | def search(x, seq):
y = len(seq)
if y == 0:
return 0
if 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_613.py |
refactory_data_question_1_correct_1_256 | 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_256.py |
refactory_data_question_1_correct_1_753 | 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_753.py |
refactory_data_question_1_correct_1_391 | def search(x, seq):
a = 0
for i in seq:
if x <= seq[a]:
return a
else:
a += 1
return a
| ./refactory/data/question_1/code/correct/correct_1_391.py |
refactory_data_question_1_correct_1_519 | 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
elif x < seq[i]:
return i
| ./refactory/data/question_1/code/correct/correct_1_519.py |
refactory_data_question_1_correct_1_054 | def search(x, seq):
seq=list(seq)
if seq==[]:
return 0
else:
for i in seq:
if x<=i:
num=seq.index(i)
break
else:
num=len(seq)
return num
| ./refactory/data/question_1/code/correct/correct_1_054.py |
refactory_data_question_1_correct_1_186 | 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(len(seq)):
if x<=seq[i]:
return i
return i... | ./refactory/data/question_1/code/correct/correct_1_186.py |
refactory_data_question_1_correct_1_095 | 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_095.py |
refactory_data_question_1_correct_1_693 | def search(x, seq):
if len(seq) == 0:
return 0
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/correct/correct_1_693.py |
refactory_data_question_1_correct_1_549 | def search(x, seq):
for a, element in enumerate(seq):
if x <= element:
return a
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_549.py |
refactory_data_question_1_correct_1_665 | 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_665.py |
refactory_data_question_1_correct_1_554 | def search(x, seq):
counter=0
for i in seq:
if x>i:
counter+=1
return counter
| ./refactory/data/question_1/code/correct/correct_1_554.py |
refactory_data_question_1_correct_1_114 | def search(x, seq):
if seq == () or seq == []:
return 0
elif 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]:
... | ./refactory/data/question_1/code/correct/correct_1_114.py |
refactory_data_question_1_correct_1_359 | 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_359.py |
refactory_data_question_1_correct_1_353 | 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_353.py |
refactory_data_question_1_correct_1_448 | 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_448.py |
refactory_data_question_1_correct_1_571 | 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_571.py |
refactory_data_question_1_correct_1_619 | def search(x, seq):
for i,elem in enumerate(seq):
if elem == x:
return i
elif elem > x:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_619.py |
refactory_data_question_1_correct_1_576 | 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_576.py |
refactory_data_question_1_correct_1_023 | 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 = -1
for i in range(len(seq)):
if x <= seq[i]:
return i
return i + 1
| ./refactory/data/question_1/code/correct/correct_1_023.py |
refactory_data_question_1_correct_1_610 | def search(x, seq):
result = 0
for i in range (len(seq)):
if seq[i] >= x:
result = i
break
else:
result = i + 1
return result
| ./refactory/data/question_1/code/correct/correct_1_610.py |
refactory_data_question_1_correct_1_637 | 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_637.py |
refactory_data_question_1_correct_1_757 | 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_757.py |
refactory_data_question_1_correct_1_662 | 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 seq == ():
return 0
elif x > seq[len(seq)-1]:
return len(seq)
else:
i = 0
while i <= le... | ./refactory/data/question_1/code/correct/correct_1_662.py |
refactory_data_question_1_correct_1_264 | def search(x, seq):
count = 0
for i in seq:
if x > i:
count = count + 1
else:
break
return count
| ./refactory/data/question_1/code/correct/correct_1_264.py |
refactory_data_question_1_correct_1_112 | 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_112.py |
refactory_data_question_1_correct_1_750 | 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_750.py |
refactory_data_question_1_correct_1_516 | 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
result = 0
while counter < len(seq):
if x < min(seq):
result = 0
break
elif x > max(seq):
... | ./refactory/data/question_1/code/correct/correct_1_516.py |
refactory_data_question_1_correct_1_739 | 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_739.py |
refactory_data_question_1_correct_1_705 | def search(x, seq):
position = 0
for i in seq:
if x <= i:
break
position = position + 1
return position
| ./refactory/data/question_1/code/correct/correct_1_705.py |
refactory_data_question_1_correct_1_017 | 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_017.py |
refactory_data_question_1_correct_1_031 | 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_031.py |
refactory_data_question_1_correct_1_727 | def search(x, seq):
if seq == () or seq == []:
return 0
if x>seq[len(seq)-1]:
return len(seq)
for i in range(len(seq)):
if x>seq[i]:
continue
return i
| ./refactory/data/question_1/code/correct/correct_1_727.py |
refactory_data_question_1_correct_1_079 | 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_079.py |
refactory_data_question_1_correct_1_342 | def search(x, seq):
if len(seq) ==0 :
return 0
else:
seq = list(seq)
max_value = max(seq)
for i,elem in enumerate(seq):
if x > max_value:
seq.insert(seq.index(max_value) + 1,x)
break
elif x<elem:
y = max(0,i)... | ./refactory/data/question_1/code/correct/correct_1_342.py |
refactory_data_question_1_correct_1_374 | 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 """
seq2 = list(enumerate(seq,0))
value = 0
for element in seq2:
if x > element[1]:
value = element[0]+1
return value
| ./refactory/data/question_1/code/correct/correct_1_374.py |
refactory_data_question_1_correct_1_768 |
def search(x, seq):
if seq==[] or seq==():
return 0
elif x<seq[0]:
return 0
elif x>seq[-1]:
return len(seq)
for i in range(len(seq)-1):
if x>seq[i] and x<=seq[i+1]:
return i+1
| ./refactory/data/question_1/code/correct/correct_1_768.py |
refactory_data_question_1_correct_1_161 | def search(x, seq):
for i in range(len(seq)-1):
if seq[i] < x <= seq[i+1]:
return i+1
elif x <= seq[0]:
return 0
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_161.py |
refactory_data_question_1_correct_1_032 | 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_032.py |
refactory_data_question_1_correct_1_544 | def search(x, seq):
n = len(seq)
if n == 0:
return 0
else:
for i in range(len(seq)):
if x < seq[0]:
return 0
elif x <= seq[i] and x >= seq[i-1]:
return i
elif x > seq[n-1]:
return n
| ./refactory/data/question_1/code/correct/correct_1_544.py |
refactory_data_question_1_correct_1_592 | def search(x, seq):
counter = 0
for i in range(len(seq)):
if x > seq[i]:
counter += 1
else:
break
return counter
| ./refactory/data/question_1/code/correct/correct_1_592.py |
refactory_data_question_1_correct_1_172 | 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_172.py |
refactory_data_question_1_correct_1_394 | def search(x, seq):
a = list(enumerate(seq))
if seq == () or seq == []:
return 0
seq = list(seq)
i = 0
while i < len(seq):
if x < seq[i] and i == 0:
return 0
elif x <= a[i][1] and x >= a[i-1][1]:
return a[i][0]
elif x > a[len(seq)-1][1]:
... | ./refactory/data/question_1/code/correct/correct_1_394.py |
refactory_data_question_1_correct_1_281 | 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)
for i,elem in enumerated_list:
if x<=elem:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_281.py |
refactory_data_question_1_correct_1_441 | 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_441.py |
refactory_data_question_1_correct_1_680 | def search(x, seq):
position = 0
for i in range(len(seq)):
if x > seq[i]:
position = i + 1
elif x == seq[i]:
position = i
return position
| ./refactory/data/question_1/code/correct/correct_1_680.py |
refactory_data_question_1_correct_1_618 | def search(x, seq):
for i,elem in enumerate(seq):
if elem == x:
return i
elif elem > x:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_618.py |
refactory_data_question_1_correct_1_577 | 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_577.py |
refactory_data_question_1_correct_1_251 | 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_251.py |
refactory_data_question_1_correct_1_657 | 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 seq == ():
return 0
elif x > seq[len(seq)-1]:
return len(seq)
else:
i = 0
while i <= le... | ./refactory/data/question_1/code/correct/correct_1_657.py |
refactory_data_question_1_correct_1_078 | 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: #if x is less/equal to the specific element in the list
return i #return the index to ... | ./refactory/data/question_1/code/correct/correct_1_078.py |
refactory_data_question_1_correct_1_230 | def search(x, seq):
value = 0
for i in range(0, len(seq)):
if (x > seq[i]):
value += 1
elif (x <= seq[i]):
break
return value
| ./refactory/data/question_1/code/correct/correct_1_230.py |
refactory_data_question_1_correct_1_007 | def search(x, seq):
for i, e in enumerate(seq):
if x <= e:
return i
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_007.py |
refactory_data_question_1_correct_1_118 | 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_118.py |
refactory_data_question_1_correct_1_366 | 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[len(seq)-1]:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_366.py |
refactory_data_question_1_correct_1_686 | def search(x, seq):
if len(seq) == 0:
return 0
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/correct/correct_1_686.py |
refactory_data_question_1_correct_1_318 | 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 < seq[0]:
return 0
if x > seq[-1]:
return len(seq)
for i in range(len(se... | ./refactory/data/question_1/code/correct/correct_1_318.py |
refactory_data_question_1_correct_1_036 | 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_036.py |
refactory_data_question_1_correct_1_203 | def search(x, seq):
if seq == () or seq == []:
return 0
else:
for i in range (len(seq)):
if x < seq[i]:
return i
elif x ==seq[i]:
return i
else:
continue
return i + 1
| ./refactory/data/question_1/code/correct/correct_1_203.py |
refactory_data_question_1_correct_1_688 | def search(x, seq):
counter = 0
for i in seq:
if x > i:
counter += 1
else:
continue
return counter
| ./refactory/data/question_1/code/correct/correct_1_688.py |
refactory_data_question_1_correct_1_735 | def search(x, seq):
for i, elem in enumerate(seq):
if x > elem and i == len(seq) - 1:
# specifies case where i has reached the last element in the tuple or list
return i + 1
elif x > elem:
continue
else:
return i
if len(seq) == ... | ./refactory/data/question_1/code/correct/correct_1_735.py |
refactory_data_question_1_correct_1_639 | 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 a in range(1,len(seq)):
if seq[a] == x:
return a
... | ./refactory/data/question_1/code/correct/correct_1_639.py |
refactory_data_question_1_correct_1_228 | def search(x, seq): #seq is sorted
pos = 0
for i in range(len(seq)):
elem = seq[i]
if x <= elem:
pos = i
break
else:
pos += 1
return pos
| ./refactory/data/question_1/code/correct/correct_1_228.py |
refactory_data_question_1_correct_1_379 | 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_379.py |
refactory_data_question_1_correct_1_720 | def search(x, seq):
seq = list(seq)
index = 0
for i in range (len(seq)):
if x <= seq[i]:
break
elif x > seq[i]:
index = i + 1
return index
| ./refactory/data/question_1/code/correct/correct_1_720.py |
refactory_data_question_1_correct_1_560 | 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_560.py |
refactory_data_question_1_correct_1_645 | def search(x, seq):
l=len(seq)
if l==0:
return 0
for i in range(l):
if x<=seq[i]:
break
if x>seq[l-1]:
i=i+1
return i
| ./refactory/data/question_1/code/correct/correct_1_645.py |
refactory_data_question_1_correct_1_331 | def search(x, seq):
if seq == ():
return 0
elif seq == []:
return 0
else:
for i,elem in enumerate(seq):
if x < seq[-1]:
if x > elem:
continue
elif x < elem and type(seq) == tuple:
seq = seq[:i] + (x,)... | ./refactory/data/question_1/code/correct/correct_1_331.py |
refactory_data_question_1_correct_1_623 | def search(x, seq):
if len(seq) == 0:
return 0
else:
for i in range(len(seq)):
if x <= seq[i] and i == 0:
return 0
elif seq[i-1] < x <= seq[i]:
return i
elif x > seq[i] and i == len(seq)-1:
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_623.py |
refactory_data_question_1_correct_1_229 | def search(x, seq):
a = list(enumerate(seq))
if seq == () or seq == []:
return 0
seq = list(seq)
i = 0
while i < len(seq):
if x < seq[i] and i == 0:
return 0
elif x <= a[i][1] and x >= a[i-1][1]:
return a[i][0]
elif x > a[len(seq)-1][1]:
... | ./refactory/data/question_1/code/correct/correct_1_229.py |
refactory_data_question_1_correct_1_076 | def search(value, seq):
for i in range(len(seq)):
if value <= seq[i]:
return i
else:
continue
return len(seq)
| ./refactory/data/question_1/code/correct/correct_1_076.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.