id
stringlengths
35
39
content
stringlengths
44
3.85k
max_stars_repo_path
stringlengths
52
57
refactory_data_question_1_correct_1_456
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 x <= elem: return i else: continue
./refactory/data/question_1/code/correct/correct_1_456.py
refactory_data_question_1_correct_1_024
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_024.py
refactory_data_question_1_correct_1_384
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_384.py
refactory_data_question_1_correct_1_261
def search(x, seq): counter = 0 for a in seq: if x > a: counter = counter + 1 return counter
./refactory/data/question_1/code/correct/correct_1_261.py
refactory_data_question_1_correct_1_210
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: return seq.index(i) return None
./refactory/data/question_1/code/correct/correct_1_210.py
refactory_data_question_1_correct_1_417
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_417.py
refactory_data_question_1_correct_1_019
def search(x, seq): counter = 0 while counter < len(seq): if x <= seq[counter]: return counter counter += 1 return counter
./refactory/data/question_1/code/correct/correct_1_019.py
refactory_data_question_1_correct_1_217
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_217.py
refactory_data_question_1_correct_1_624
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_624.py
refactory_data_question_1_correct_1_546
def search(x, seq): if not seq: i = 0 else: if x > seq[len(seq)-1]: i = len(seq) else: for i, elem in enumerate(seq): if x <= elem: i break return i
./refactory/data/question_1/code/correct/correct_1_546.py
refactory_data_question_1_correct_1_608
def search(x, seq): if seq == [] or seq ==(): return 0 elif x > seq[ len(seq)- 1]: return len(seq) elif x < seq[0]: return 0 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_608.py
refactory_data_question_1_correct_1_356
def search(x, seq): if type(seq) == list: seq.append(x) seq.sort() for i, elem in enumerate(seq): if elem == x: return i else: seq+=(x,) for i, elem in enumerate(sorted(seq)): if elem == x: return i
./refactory/data/question_1/code/correct/correct_1_356.py
refactory_data_question_1_correct_1_747
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_seq)): if max(new_seq) < x: sort.extend(new_seq) sort.append(x) elif new_seq[i] >=x: sort.append(x) sort.extend(new_seq[i:]) break elif new_seq[i]<x: sort.append(new_seq[i]) else: sort = [] for i in range(len(seq)): if max(seq) < x: sort.extend(seq) sort.append(x) elif seq[i] >=x: sort.append(x) sort.extend(seq[i:]) break elif seq[i]<x: sort.append(seq[i]) positions = list(enumerate(sort)) for i in positions: if i[1] == x: return i[0] else: continue
./refactory/data/question_1/code/correct/correct_1_747.py
refactory_data_question_1_correct_1_033
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]: return j+1
./refactory/data/question_1/code/correct/correct_1_033.py
refactory_data_question_1_correct_1_596
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_596.py
refactory_data_question_1_correct_1_134
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_134.py
refactory_data_question_1_correct_1_341
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) return helper(index)
./refactory/data/question_1/code/correct/correct_1_341.py
refactory_data_question_1_correct_1_377
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 """ 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_377.py
refactory_data_question_1_correct_1_437
def search(x, seq): position = 0 for i in seq: if x > i: position += 1 else: return position return position
./refactory/data/question_1/code/correct/correct_1_437.py
refactory_data_question_1_correct_1_484
def search(x, seq): result=0 for i in range(len(seq)): if seq[i]<x: result+=1 return result
./refactory/data/question_1/code/correct/correct_1_484.py
refactory_data_question_1_correct_1_288
def search(x, seq): for i in range(len(seq)): if x <= seq[i]: return seq.index(seq[i]) elif seq[-1] < x: return seq.index(seq[-1])+1 return 0
./refactory/data/question_1/code/correct/correct_1_288.py
refactory_data_question_1_correct_1_135
def search(x, seq): if seq == (): return 0 elif seq == []: return 0 for i, elem in enumerate(seq): if x == elem: return i elif x < elem: return i elif x > seq[-1]: return len(seq)
./refactory/data/question_1/code/correct/correct_1_135.py
refactory_data_question_1_correct_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, element in enumerate(seq): if x <= element: return i else: continue return len(seq)
./refactory/data/question_1/code/correct/correct_1_243.py
refactory_data_question_1_correct_1_113
def search(x, seq): for pos,ele in enumerate(seq): if ele >= x: return pos return len(seq)
./refactory/data/question_1/code/correct/correct_1_113.py
refactory_data_question_1_correct_1_083
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_083.py
refactory_data_question_1_correct_1_163
def search(x,seq): if not seq: return 0 for i,elem in enumerate(seq): if elem>=x: return i return len(seq)
./refactory/data/question_1/code/correct/correct_1_163.py
refactory_data_question_1_correct_1_668
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_668.py
refactory_data_question_1_correct_1_414
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_list: if x <= number[1]: res = number[0] break else: res = len(seq) return res
./refactory/data/question_1/code/correct/correct_1_414.py
refactory_data_question_1_correct_1_320
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_320.py
refactory_data_question_1_correct_1_280
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_280.py
refactory_data_question_1_correct_1_599
def search(x, seq): if type(seq) == tuple: if seq == (): return 0 else: for i in range(len(seq)): if x <= seq[i]: seq = seq[:i] + (x,) + seq[i:] elif seq[len(seq)-1] < x: seq = seq + (x,) elif type(seq) == list: if seq == []: return 0 else: for i in range(len(seq)): if x <= seq[i]: seq = seq[:i] + [x,] + seq[i:] elif seq[len(seq)-1] < x: seq = seq + [x,] for i in enumerate(seq): if x == i[1]: return i[0]
./refactory/data/question_1/code/correct/correct_1_599.py
refactory_data_question_1_correct_1_204
def search(x, seq): if not seq: return 0 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/correct/correct_1_204.py
refactory_data_question_1_correct_1_717
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_717.py
refactory_data_question_1_correct_1_736
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) == 0: return 0 # this is if seq is empty # if not defined, task 3(a) won't work
./refactory/data/question_1/code/correct/correct_1_736.py
refactory_data_question_1_correct_1_345
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) seq.insert(y,x) break return seq.index(x)
./refactory/data/question_1/code/correct/correct_1_345.py
refactory_data_question_1_correct_1_395
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_395.py
refactory_data_question_1_correct_1_469
def search(x, seq): if len(seq) == 0: return 0 else: for i in range(len(seq)-1): if x > seq[i] and x <= seq[i+1]: return i+1 if x < seq[0]: return 0 elif x > seq[len(seq)-1]: return len(seq)
./refactory/data/question_1/code/correct/correct_1_469.py
refactory_data_question_1_correct_1_603
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_603.py
refactory_data_question_1_correct_1_691
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_seq)): if max(new_seq) < x: sort.extend(new_seq) sort.append(x) elif new_seq[i] >=x: sort.append(x) sort.extend(new_seq[i:]) break elif new_seq[i]<x: sort.append(new_seq[i]) else: sort = [] for i in range(len(seq)): if max(seq) < x: sort.extend(seq) sort.append(x) elif seq[i] >=x: sort.append(x) sort.extend(seq[i:]) break elif seq[i]<x: sort.append(seq[i]) positions = list(enumerate(sort)) for i in positions: if i[1] == x: return i[0] else: continue
./refactory/data/question_1/code/correct/correct_1_691.py
refactory_data_question_1_correct_1_226
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_226.py
refactory_data_question_1_correct_1_307
def search(x, seq): if len(seq)==0: return 0 for i, elem in enumerate(seq): if x<=elem: return i return len(seq)
./refactory/data/question_1/code/correct/correct_1_307.py
refactory_data_question_1_correct_1_109
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(start) newseq.pop(0) sortlist.extend(newseq) for pos, elem in enumerate(sortlist): if elem == x: return pos
./refactory/data/question_1/code/correct/correct_1_109.py
refactory_data_question_1_correct_1_597
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_597.py
refactory_data_question_1_correct_1_625
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_625.py
refactory_data_question_1_correct_1_006
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 """ output = 0 while output < len(seq): if x > seq[output]: output += 1 else: break return output
./refactory/data/question_1/code/correct/correct_1_006.py
refactory_data_question_1_correct_1_405
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_405.py
refactory_data_question_1_correct_1_533
def search(x, seq): counter = 0 for a in seq: if x > a: counter = counter + 1 return counter
./refactory/data/question_1/code/correct/correct_1_533.py
refactory_data_question_1_correct_1_660
def search(x, seq): if not seq: return 0 elif x < seq[0]: return 0 for i in range(len(seq)): if i == len(seq) - 1: return len(seq) if x >= seq[i] and x <= seq[i+1]: return i+1
./refactory/data/question_1/code/correct/correct_1_660.py
refactory_data_question_1_correct_1_094
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_094.py
refactory_data_question_1_correct_1_666
def search(x, seq): counter = 0 for i in seq: counter += 1 if x <= i: return counter-1 return len(seq)
./refactory/data/question_1/code/correct/correct_1_666.py
refactory_data_question_1_correct_1_364
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_364.py
refactory_data_question_1_correct_1_241
def search(x, seq): for position in range(len(seq)): if x < seq[position] or x == seq[position]: return position return len(seq)
./refactory/data/question_1/code/correct/correct_1_241.py
refactory_data_question_1_correct_1_462
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_462.py
refactory_data_question_1_correct_1_555
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_555.py
refactory_data_question_1_correct_1_538
def search(x, seq): index = 0 for i in seq: if x>i: index+=1 else: return index return index
./refactory/data/question_1/code/correct/correct_1_538.py
refactory_data_question_1_correct_1_110
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, elem in enumerate(seq): if x <= elem: return i
./refactory/data/question_1/code/correct/correct_1_110.py
refactory_data_question_1_correct_1_502
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_502.py
refactory_data_question_1_correct_1_165
def search(x, seq): for k in range(len(seq)): if x <= seq[k]: return k elif x > seq[k]: continue return len(seq) # if bigger than the last element
./refactory/data/question_1/code/correct/correct_1_165.py
refactory_data_question_1_correct_1_754
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_754.py
refactory_data_question_1_correct_1_542
def search(x, seq): if type(seq) == tuple: seq = list(seq) seq.append(x) a = sorted(seq) return a.index(x) elif type(seq) == list: seq.append(x) a = sorted(seq) return a.index(x)
./refactory/data/question_1/code/correct/correct_1_542.py
refactory_data_question_1_correct_1_143
def search(x, seq): if seq==[]or seq==(): return 0 for count, ele in enumerate(seq): if x<=ele: return count for ele in seq: if x>ele: return len(seq)
./refactory/data/question_1/code/correct/correct_1_143.py
refactory_data_question_1_correct_1_759
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 x<=seq[i]: return i break else: return len(seq)
./refactory/data/question_1/code/correct/correct_1_759.py
refactory_data_question_1_correct_1_072
def search(x, seq): i=0 while i<len(seq): if x<=seq[i]: break i=i+1 return i
./refactory/data/question_1/code/correct/correct_1_072.py
refactory_data_question_1_correct_1_485
def search(x, seq): counter=0 for i in seq: if x > i: counter+=1 else: break return counter
./refactory/data/question_1/code/correct/correct_1_485.py
refactory_data_question_1_correct_1_628
def search(x, seq): for i in range(len(seq)): if seq[i] >= x: return i continue 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_628.py
refactory_data_question_1_correct_1_640
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 searchlist = list(enumerate(seq)) for i in range(len(searchlist)): if x <= searchlist[i][1]: return searchlist[i][0] return i+ 1
./refactory/data/question_1/code/correct/correct_1_640.py
refactory_data_question_1_correct_1_273
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_273.py
refactory_data_question_1_correct_1_160
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_160.py
refactory_data_question_1_correct_1_153
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_153.py
refactory_data_question_1_correct_1_184
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 <= seq[i + 1]: return i + 1 elif x > seq[-1]: return len(seq) return 0
./refactory/data/question_1/code/correct/correct_1_184.py
refactory_data_question_1_correct_1_622
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_622.py
refactory_data_question_1_correct_1_511
def search(x, seq): for i, elem in enumerate(seq): if len(seq) == 0: return 0 elif i == 0 and x < elem: return 0 elif x <= elem: return i elif i == len(seq) - 1: return len(seq) 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_511.py
refactory_data_question_1_correct_1_011
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_011.py
refactory_data_question_1_correct_1_009
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_009.py
refactory_data_question_1_correct_1_461
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_461.py
refactory_data_question_1_correct_1_262
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_262.py
refactory_data_question_1_correct_1_716
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_716.py
refactory_data_question_1_correct_1_737
def search(x, seq): num = 0 for i in seq: if x <= seq[num]: return num num += 1 else: return num
./refactory/data/question_1/code/correct/correct_1_737.py
refactory_data_question_1_correct_1_030
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]: return j+1
./refactory/data/question_1/code/correct/correct_1_030.py
refactory_data_question_1_correct_1_752
def search(x, seq): counter = 0 for i in range(len(seq)): if x <= seq[i]: break else: counter += 1 return counter
./refactory/data/question_1/code/correct/correct_1_752.py
refactory_data_question_1_correct_1_010
def search(x, seq): position = 0 for i, elem in enumerate(seq): if x <= elem: position = i return position else: position = i + 1 return position
./refactory/data/question_1/code/correct/correct_1_010.py
refactory_data_question_1_correct_1_166
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_166.py
refactory_data_question_1_correct_1_644
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_644.py
refactory_data_question_1_correct_1_562
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_562.py
refactory_data_question_1_correct_1_365
def search(x, seq): if seq == () or seq == []: return 0 elif 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/correct/correct_1_365.py
refactory_data_question_1_correct_1_302
def search(x, seq): if seq==() or seq==[]: return 0 for a,b in enumerate(seq): if x<=b: return a for i in seq: if x>i: return a+1
./refactory/data/question_1/code/correct/correct_1_302.py
refactory_data_question_1_correct_1_690
def search(x, seq): if seq == []: return 0 else: for i in range(len(seq)): if x <= seq[i]: return i return len(seq)
./refactory/data/question_1/code/correct/correct_1_690.py
refactory_data_question_1_correct_1_626
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]): product = product + i + 1 return product
./refactory/data/question_1/code/correct/correct_1_626.py
refactory_data_question_1_correct_1_390
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_390.py
refactory_data_question_1_correct_1_142
def search(x, seq): seq_len = len(seq) for i in range(seq_len): if x <= seq[i]: return i return seq_len
./refactory/data/question_1/code/correct/correct_1_142.py
refactory_data_question_1_correct_1_714
def search(x, seq): length = len(seq) if length == 0: return 0 else: for i, elem in enumerate(seq): if x <= elem: return i elif i == length-1: return length
./refactory/data/question_1/code/correct/correct_1_714.py
refactory_data_question_1_correct_1_611
def search(x, seq): result=0 for i in range(len(seq)): if seq[i]<x: result+=1 return result
./refactory/data/question_1/code/correct/correct_1_611.py
refactory_data_question_1_correct_1_239
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): result = len(seq) break elif x <= seq[counter]: result = counter break counter += 1 return result
./refactory/data/question_1/code/correct/correct_1_239.py
refactory_data_question_1_correct_1_478
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_478.py
refactory_data_question_1_correct_1_045
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_045.py
refactory_data_question_1_correct_1_001
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_001.py
refactory_data_question_1_correct_1_350
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 a = 0 while n < len(seq): if seq[n] < x: n = n + 1 a = n else: break return a
./refactory/data/question_1/code/correct/correct_1_350.py
refactory_data_question_1_correct_1_062
def search(x, seq): if len(seq) == 0: return 0 else: for i in range(len(seq)-1): if x > seq[i] and x <= seq[i+1]: return i+1 if x < seq[0]: return 0 elif x > seq[len(seq)-1]: return len(seq)
./refactory/data/question_1/code/correct/correct_1_062.py
refactory_data_question_1_correct_1_151
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_151.py
refactory_data_question_1_correct_1_534
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_534.py