Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
35
39
content
stringlengths
44
3.85k
max_stars_repo_path
stringlengths
52
57
refactory_data_question_1_correct_1_192
def search(x, seq): i=0 while i<len(seq): if x<=seq[i]: return i else: i+=1 return len(seq)
./refactory/data/question_1/code/correct/correct_1_192.py
refactory_data_question_1_correct_1_466
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_466.py
refactory_data_question_1_correct_1_148
def search(x, seq): index = [] for i, elem in enumerate(seq): index += [[i, elem],] for i in index: if x <= i[1]: return i[0] else: return len(seq)
./refactory/data/question_1/code/correct/correct_1_148.py
refactory_data_question_1_correct_1_708
def search(x, seq): position = 0 for i in seq: if x > i: position +=1 else: return position if position ==len(seq)-1: return position+1 else: return position
./refactory/data/question_1/code/correct/correct_1_708.py
refactory_data_question_1_correct_1_244
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_244.py
refactory_data_question_1_correct_1_429
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_429.py
refactory_data_question_1_correct_1_547
def search(x, seq): if len(seq) == 0: return 0 else: for i, elem in enumerate(seq): if x > elem and i < (len(seq)-1): continue elif x <= elem: return i else: return len(seq)
./refactory/data/question_1/code/correct/correct_1_547.py
refactory_data_question_1_correct_1_685
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_685.py
refactory_data_question_1_correct_1_104
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_104.py
refactory_data_question_1_correct_1_512
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_512.py
refactory_data_question_1_correct_1_119
def search(x, seq): counter=0 for i in seq: if x<= i: return counter counter+=1 return counter
./refactory/data/question_1/code/correct/correct_1_119.py
refactory_data_question_1_correct_1_158
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_158.py
refactory_data_question_1_correct_1_489
def search(x, seq): i = 0 for i, ele in enumerate(seq, 0): if x > ele: i += 1 else: break return i
./refactory/data/question_1/code/correct/correct_1_489.py
refactory_data_question_1_correct_1_069
def search(x, seq): a = len(seq) if a == 0: return 0 if a !=0 and x < seq[0]: return 0 elif a!= 0 and x > seq[-1]: return a else: for i in range(a): if x == seq[i]: return i elif x < seq[i]: return i
./refactory/data/question_1/code/correct/correct_1_069.py
refactory_data_question_1_correct_1_702
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_702.py
refactory_data_question_1_correct_1_532
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_532.py
refactory_data_question_1_correct_1_162
def search(x, seq): length = len(seq) if length == 0: return 0 elif length == 1: return 0 if x < seq[0] else 1 else: for i in range(length): if x <= seq[i]: return i return length # x is larger than everything in seq, so x goes to the end
./refactory/data/question_1/code/correct/correct_1_162.py
refactory_data_question_1_correct_1_616
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 should go to such that the sequence remains sorted """
./refactory/data/question_1/code/correct/correct_1_616.py
refactory_data_question_1_correct_1_589
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_589.py
refactory_data_question_1_correct_1_557
def search(x, seq): pos = 0 for i, element in enumerate(seq): if x <= element: pos = i return pos else: pos += 1 return pos
./refactory/data/question_1/code/correct/correct_1_557.py
refactory_data_question_1_correct_1_389
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_389.py
refactory_data_question_1_correct_1_655
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_655.py
refactory_data_question_1_correct_1_526
def search(x, seq): """ Takes in a value x and a sorted sequence seq, and returns the position that x should go to such that the sequence remains sorted """ position = 0 found = False while position < len(seq) and not found: if x <= seq[position]: found = True else: position += 1 return position
./refactory/data/question_1/code/correct/correct_1_526.py
refactory_data_question_1_correct_1_052
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_052.py
refactory_data_question_1_correct_1_128
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_128.py
refactory_data_question_1_correct_1_173
def search(x, seq): for i, elem in enumerate(seq): if elem>=x: return i else: continue return len(seq)
./refactory/data/question_1/code/correct/correct_1_173.py
refactory_data_question_1_correct_1_564
def search(x, seq): count=0 for i in seq: if x<=i: return count count+=1 return len(seq)
./refactory/data/question_1/code/correct/correct_1_564.py
refactory_data_question_1_correct_1_424
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_424.py
refactory_data_question_1_correct_1_068
def search(x, seq): position = 0 for i in range(len(seq)): if x > seq[i]: position = position+1 return position
./refactory/data/question_1/code/correct/correct_1_068.py
refactory_data_question_1_correct_1_127
def search(x, seq): k = 0 for i in range(len(seq)): if x <= seq[i]: break k = i + 1 return k
./refactory/data/question_1/code/correct/correct_1_127.py
refactory_data_question_1_correct_1_305
def search(x, seq): if len(seq)==0: return 0 for i in range(len(seq)): if x<=seq[i]:break if i==len(seq)-1: i+=1 return i
./refactory/data/question_1/code/correct/correct_1_305.py
refactory_data_question_1_correct_1_194
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_194.py
refactory_data_question_1_correct_1_290
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, j in enumerate(seq): if x <= j: return i return len(seq)
./refactory/data/question_1/code/correct/correct_1_290.py
refactory_data_question_1_correct_1_402
def search(x, seq): i = 0 for i, ele in enumerate(seq, 0): if x > ele: i += 1 else: break return i
./refactory/data/question_1/code/correct/correct_1_402.py
refactory_data_question_1_correct_1_260
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_260.py
refactory_data_question_1_correct_1_642
def search(x, seq): if not seq: return 0 for i, elem in enumerate(seq): if x <= elem: return i return len(seq)
./refactory/data/question_1/code/correct/correct_1_642.py
refactory_data_question_1_correct_1_681
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 return a
./refactory/data/question_1/code/correct/correct_1_681.py
refactory_data_question_1_correct_1_548
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_548.py
refactory_data_question_1_correct_1_748
def search(x, seq): result=0 for i in seq: if x>i: result+=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 result
./refactory/data/question_1/code/correct/correct_1_748.py
refactory_data_question_1_correct_1_220
def search(x, seq): """ Takes in a value x and a sorted sequence seq, and returns the position that x should go to such that the sequence remains sorted """ if seq == () or seq == [] or x <= seq[0]: return 0 elif x > seq[-1]: return len(seq) else: for i,j in enumerate(seq[:len(seq)-1]): if x > j and x <= seq[i+1]: return i+1
./refactory/data/question_1/code/correct/correct_1_220.py
refactory_data_question_1_correct_1_249
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 elif x > seq[-1]: return len(seq) for i in range(len(seq)): if x == seq[i]: return i elif x > seq[i-1] and x < seq[i]: return i
./refactory/data/question_1/code/correct/correct_1_249.py
refactory_data_question_1_correct_1_124
def search(x, seq): if seq == () or seq == []: 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/correct/correct_1_124.py
refactory_data_question_1_correct_1_767
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_767.py
refactory_data_question_1_correct_1_566
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 if seq == (): #Terminates if there is no list of tuple at all return position else: for i in range(len(seq)): if x <= seq[i]: #Termniates once the sorted position is found position = i break elif i == len(seq)-1: #Teminates when it finished sorting through and all are smaller position = len(seq) return position
./refactory/data/question_1/code/correct/correct_1_566.py
refactory_data_question_1_correct_1_393
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_393.py
refactory_data_question_1_correct_1_715
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_715.py
refactory_data_question_1_correct_1_722
def search(x, seq): counter=0 for i in seq: if i>=x: break counter=counter+1 return counter
./refactory/data/question_1/code/correct/correct_1_722.py
refactory_data_question_1_correct_1_704
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 if len(seq) == 0: return 0 for i in seq: if x <= i: return counter else: counter += 1 return counter
./refactory/data/question_1/code/correct/correct_1_704.py
refactory_data_question_1_correct_1_434
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_434.py
refactory_data_question_1_correct_1_066
def search(x, seq): position=0 for i in range(len(seq)): if x>seq[i]: position+=1 else: return position return position
./refactory/data/question_1/code/correct/correct_1_066.py
refactory_data_question_1_correct_1_214
def search(x, seq): a = 0 for i,j in enumerate(seq): if x > j and i < len(seq)-1: continue elif x <= j: a = i break else: a = len(seq) return a
./refactory/data/question_1/code/correct/correct_1_214.py
refactory_data_question_1_correct_1_276
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_276.py
refactory_data_question_1_correct_1_435
def search(x, seq): counter = 0 new_seq = list(seq) if new_seq == []: return 0 for element in seq: if x <=element: return counter if x > seq[len(seq)-1]: return len(seq) else: counter += 1 continue
./refactory/data/question_1/code/correct/correct_1_435.py
refactory_data_question_1_correct_1_385
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_385.py
refactory_data_question_1_correct_1_725
def search(x, seq): if not seq: return 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 return indx
./refactory/data/question_1/code/correct/correct_1_725.py
refactory_data_question_1_correct_1_696
def search(x, seq): if seq == (): return 0 if seq == []: return 0 for c,value in enumerate(seq): if value>=x: return(c) else: return(c+1)
./refactory/data/question_1/code/correct/correct_1_696.py
refactory_data_question_1_correct_1_003
def search(x, seq): seq = list(seq) if seq == []: return 0 else: 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_003.py
refactory_data_question_1_correct_1_646
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 return a
./refactory/data/question_1/code/correct/correct_1_646.py
refactory_data_question_1_correct_1_602
def search(x, seq): if len(seq) == 0: return 0 elif x > 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_602.py
refactory_data_question_1_correct_1_321
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 elif x > seq[-1]: return len(seq) for i in range(len(seq)): if x == seq[i]: return i elif x > seq[i-1] and x < seq[i]: return i
./refactory/data/question_1/code/correct/correct_1_321.py
refactory_data_question_1_correct_1_418
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_418.py
refactory_data_question_1_correct_1_758
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(seq).index(max(seq)))+1
./refactory/data/question_1/code/correct/correct_1_758.py
refactory_data_question_1_correct_1_513
def search(x, seq): if seq==() or seq==[]: return 0 else: largest=seq[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/correct/correct_1_513.py
refactory_data_question_1_correct_1_336
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_336.py
refactory_data_question_1_correct_1_409
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_409.py
refactory_data_question_1_correct_1_569
def search(x, seq): if len(seq) == 0 or 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]: return i
./refactory/data/question_1/code/correct/correct_1_569.py
refactory_data_question_1_correct_1_490
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_490.py
refactory_data_question_1_correct_1_433
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_433.py
refactory_data_question_1_correct_1_125
def search(x, seq): if len(seq) == 0: return 0 else: for i in seq: if x <= i: return seq.index(i) elif x > max(seq): return len(seq)
./refactory/data/question_1/code/correct/correct_1_125.py
refactory_data_question_1_correct_1_223
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_223.py
refactory_data_question_1_correct_1_300
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_300.py
refactory_data_question_1_correct_1_272
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_272.py
refactory_data_question_1_correct_1_729
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_729.py
refactory_data_question_1_correct_1_428
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(seq) break return pos
./refactory/data/question_1/code/correct/correct_1_428.py
refactory_data_question_1_correct_1_145
def search(x, seq): for i in range(len(seq)): if x<=seq[i]: return i return len(seq) #if x is larger then all element in seq
./refactory/data/question_1/code/correct/correct_1_145.py
refactory_data_question_1_correct_1_349
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_349.py
refactory_data_question_1_correct_1_740
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_740.py
refactory_data_question_1_correct_1_367
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 else: return len(seq)
./refactory/data/question_1/code/correct/correct_1_367.py
refactory_data_question_1_correct_1_479
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 else: return 0
./refactory/data/question_1/code/correct/correct_1_479.py
refactory_data_question_1_correct_1_525
def search(x, seq): if seq==() or seq==[]: return 0 else: largest=seq[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/correct/correct_1_525.py
refactory_data_question_1_correct_1_756
def search(x, seq): i = 0 for i, element in enumerate(seq): if x <= element: return i return len(seq)
./refactory/data/question_1/code/correct/correct_1_756.py
refactory_data_question_1_correct_1_310
def search(x, seq): i = 0 for element in seq: if x > element: i = i + 1 return i
./refactory/data/question_1/code/correct/correct_1_310.py
refactory_data_question_1_correct_1_034
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_034.py
refactory_data_question_1_correct_1_530
def search(x, seq): if len(seq)==0 or 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_530.py
refactory_data_question_1_correct_1_136
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_136.py
refactory_data_question_1_correct_1_743
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_743.py
refactory_data_question_1_correct_1_733
def search(x, seq): seq = list(seq) for i in range(len(seq)): if x > seq[i]: continue elif x <= seq[i]: return i return len(seq)
./refactory/data/question_1/code/correct/correct_1_733.py
refactory_data_question_1_correct_1_420
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_420.py
refactory_data_question_1_correct_1_296
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 """ count = 0 if seq == () or seq == []: return 0 else: if x <= seq[0]: return 0 elif x > seq[len(seq)-1]: return len(seq) else: while x > seq[count]: count += 1 return count
./refactory/data/question_1/code/correct/correct_1_296.py
refactory_data_question_1_correct_1_556
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_556.py
refactory_data_question_1_correct_1_027
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 be inserted in return len(seq)
./refactory/data/question_1/code/correct/correct_1_027.py
refactory_data_question_1_correct_1_057
def search(x, seq): for j, elem in enumerate(seq): if x<= elem: return j return len(seq)
./refactory/data/question_1/code/correct/correct_1_057.py
refactory_data_question_1_correct_1_505
def search(x, seq): if seq == (): return 0 elif seq == []: return 0 else: next 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 remains sorted """
./refactory/data/question_1/code/correct/correct_1_505.py
refactory_data_question_1_correct_1_667
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 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_667.py
refactory_data_question_1_correct_1_212
def search(x, seq): if len(seq) == 0: return 0 else: for i, elem in enumerate(seq): if x <= elem: return i return len(seq)
./refactory/data/question_1/code/correct/correct_1_212.py
refactory_data_question_1_correct_1_338
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_338.py
refactory_data_question_1_correct_1_049
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_049.py
refactory_data_question_1_correct_1_301
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(seq).index(max(seq)))+1
./refactory/data/question_1/code/correct/correct_1_301.py
refactory_data_question_1_correct_1_312
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_312.py
refactory_data_question_1_correct_1_493
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_493.py
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
2