id
stringlengths
35
39
content
stringlengths
44
3.85k
max_stars_repo_path
stringlengths
52
57
refactory_data_question_1_wrong_1_031
def search(x, seq): for i in range(len(seq)): if len(seq)==0: return 0 elif x<=seq[i]: return i elif x>seq[len(seq)-1]: return len(seq) else: continue
./refactory/data/question_1/code/wrong/wrong_1_031.py
refactory_data_question_1_wrong_1_268
def search(x, seq): counter = 0 new_seq = list(seq) 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/wrong/wrong_1_268.py
refactory_data_question_1_wrong_1_192
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_192.py
refactory_data_question_1_wrong_1_218
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 == []: return 0 for i, elem in enumerate(seq): if x <= elem: return i if i == (len(seq)-1): return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_218.py
refactory_data_question_1_wrong_1_256
def search(x, seq): a = list(enumerate(seq)) seq = list(seq) i = 0 while i < len(seq): if seq == []: return 0 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]: return len(seq) else: i = i + 1 return seq
./refactory/data/question_1/code/wrong/wrong_1_256.py
refactory_data_question_1_wrong_1_339
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_339.py
refactory_data_question_1_wrong_1_466
def search(x, seq): if seq == () or []: 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/wrong/wrong_1_466.py
refactory_data_question_1_wrong_1_148
#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: for item in seq: if val <= item: position = seq.index(item)-1 return position
./refactory/data/question_1/code/wrong/wrong_1_148.py
refactory_data_question_1_wrong_1_397
def search(x, seq): if seq == (): return else: for i in range(len(seq)): if x <= seq[i]: return i elif x >= max(seq): return len(seq) else: continue
./refactory/data/question_1/code/wrong/wrong_1_397.py
refactory_data_question_1_wrong_1_542
def search(x, seq): if seq == () or []: 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 return indx
./refactory/data/question_1/code/wrong/wrong_1_542.py
refactory_data_question_1_wrong_1_232
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/wrong/wrong_1_232.py
refactory_data_question_1_wrong_1_022
def search(x, seq): lst = list(seq) for i in range(len(lst)): if x < lst[i]: lst.insert(i,x) else: lst.insert(len(lst),x) for i in range(len(lst)): if lst[i] == x: return i
./refactory/data/question_1/code/wrong/wrong_1_022.py
refactory_data_question_1_wrong_1_495
def search(x, seq): if seq == () or []: return 0 else: for i, elem in enumerate (seq): if x<=elem: return i elif x>seq[-1]: return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_495.py
refactory_data_question_1_wrong_1_262
def search(x, seq): for i in len(range(seq)): if x <= i: return i return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_262.py
refactory_data_question_1_wrong_1_169
def search(x, seq): 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_169.py
refactory_data_question_1_wrong_1_398
def search(x, seq): if seq == (): return () else: for i in range(len(seq)): if x <= seq[i]: return i elif x >= max(seq): return len(seq) else: continue
./refactory/data/question_1/code/wrong/wrong_1_398.py
refactory_data_question_1_wrong_1_484
def search(x, seq): result = 0 for i in range(len(seq)): if seq[i] > x: result = i return result
./refactory/data/question_1/code/wrong/wrong_1_484.py
refactory_data_question_1_wrong_1_182
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(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)))
./refactory/data/question_1/code/wrong/wrong_1_182.py
refactory_data_question_1_wrong_1_146
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 else: n.append(x) n.extend(seq) break count = list(enumerate(n)) for b in count: d+=1 if b[1] == x: return b[0] elif d==len(count): return d
./refactory/data/question_1/code/wrong/wrong_1_146.py
refactory_data_question_1_wrong_1_124
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-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_124.py
refactory_data_question_1_wrong_1_421
def search(x, seq): 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_421.py
refactory_data_question_1_wrong_1_411
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_411.py
refactory_data_question_1_wrong_1_094
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 if x>seq[-1]: return len(seq) else: for i,elem in enumerate(seq): if x>elem and x<=seq[i+1]: return i+1
./refactory/data/question_1/code/wrong/wrong_1_094.py
refactory_data_question_1_wrong_1_539
def search(x, seq): for i in range(len(seq)): if seq[i]>=x: break elif seq[-1]<x: return len(seq) return i
./refactory/data/question_1/code/wrong/wrong_1_539.py
refactory_data_question_1_wrong_1_046
def search(x, seq): for i in range(len(seq)): if x < seq[i]: return i elif seq[i] == seq[-1]: return i+1 elif seq[i]<x<=seq[i+1]: return i return len(seq)+1
./refactory/data/question_1/code/wrong/wrong_1_046.py
refactory_data_question_1_wrong_1_462
def search(x, seq): if seq == [] or seq == (): return 0 elif len(seq) == 1: if seq[0] < x: return 0 else: return 1 elif seq[-1] <= x: return len(seq) elif seq[0] >= x: 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/wrong/wrong_1_462.py
refactory_data_question_1_wrong_1_450
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_450.py
refactory_data_question_1_wrong_1_393
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) sorted(seq) return seq.index(x)
./refactory/data/question_1/code/wrong/wrong_1_393.py
refactory_data_question_1_wrong_1_080
def search(x, seq): if seq==[]or(): 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/wrong/wrong_1_080.py
refactory_data_question_1_wrong_1_508
def search(x, seq): for i in range(len(seq)): if x <= seq[i]: return i
./refactory/data/question_1/code/wrong/wrong_1_508.py
refactory_data_question_1_wrong_1_297
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)+1 return i
./refactory/data/question_1/code/wrong/wrong_1_297.py
refactory_data_question_1_wrong_1_555
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 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/wrong/wrong_1_555.py
refactory_data_question_1_wrong_1_254
def search(x, seq): a = list(enumerate(seq)) seq = list(seq) i = 0 while i < len(seq): if x < seq[i] and i == 0: seq.insert(a[i][0], x) i = i + 2 elif x < seq[i] and x > seq[i-1]: seq.insert(a[i][0],x) i = i + 2 elif x > seq[len(seq)-1]: seq.append(x) i = i + 2 else: i = i + 1 return seq
./refactory/data/question_1/code/wrong/wrong_1_254.py
refactory_data_question_1_wrong_1_479
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 == []: return 0 for i in range(len(seq)): if x <= seq[i]: return i if x > seq[-1]: return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_479.py
refactory_data_question_1_wrong_1_573
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 == []: return 0 if x < seq[0]: return 0 elif x > seq[len(seq)-1]: return len(seq) else: for i in range(len(seq)-1): if seq[i] == x: return i elif seq[i] < x and seq[i+1] > x: return i+1
./refactory/data/question_1/code/wrong/wrong_1_573.py
refactory_data_question_1_wrong_1_531
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: counter += 1 else: return counter return counter
./refactory/data/question_1/code/wrong/wrong_1_531.py
refactory_data_question_1_wrong_1_099
def search(x, seq): 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/wrong/wrong_1_099.py
refactory_data_question_1_wrong_1_185
def search(x, seq): for i in seq: if x>i: continue return seq.index(i)-1
./refactory/data/question_1/code/wrong/wrong_1_185.py
refactory_data_question_1_wrong_1_439
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 = a+1 return a
./refactory/data/question_1/code/wrong/wrong_1_439.py
refactory_data_question_1_wrong_1_404
def search(x, seq): counter=0 for i in seq: if x<i: counter+=1 else: break return counter
./refactory/data/question_1/code/wrong/wrong_1_404.py
refactory_data_question_1_wrong_1_108
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/wrong/wrong_1_108.py
refactory_data_question_1_wrong_1_057
def search(x, seq): if 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/wrong/wrong_1_057.py
refactory_data_question_1_wrong_1_487
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==[]: 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/wrong/wrong_1_487.py
refactory_data_question_1_wrong_1_034
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-1 else: return i-1
./refactory/data/question_1/code/wrong/wrong_1_034.py
refactory_data_question_1_wrong_1_090
def search(x, seq): 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_090.py
refactory_data_question_1_wrong_1_293
def search(x, seq): for i in range(len(seq)): if x < seq[i]: continue elif x >= seq[i]: break return i
./refactory/data/question_1/code/wrong/wrong_1_293.py
refactory_data_question_1_wrong_1_279
def search(x, seq): for i in range(0, len(seq) + 1): if 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/wrong/wrong_1_279.py
refactory_data_question_1_wrong_1_562
def search(x,seq): if max(seq) < x: return len(seq) if x <= min(seq): return 0
./refactory/data/question_1/code/wrong/wrong_1_562.py
refactory_data_question_1_wrong_1_500
def search(x, seq): for i in range(len(seq)): if x<= seq[i]: return i return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_500.py
refactory_data_question_1_wrong_1_312
def search(x, seq): for i in range(len(seq)): if x<=seq[i]: return i return i+1
./refactory/data/question_1/code/wrong/wrong_1_312.py
refactory_data_question_1_wrong_1_202
def search(x, seq): l=len(seq) if x<=seq[0]: return 0 elif x>=seq[l-1]: return l+1 else: for i in range (l): if x>=seq[i] and x<=seq[i+1]: return i+1 else: continue
./refactory/data/question_1/code/wrong/wrong_1_202.py
refactory_data_question_1_wrong_1_543
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 return indx
./refactory/data/question_1/code/wrong/wrong_1_543.py
refactory_data_question_1_wrong_1_355
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 += position return position
./refactory/data/question_1/code/wrong/wrong_1_355.py
refactory_data_question_1_wrong_1_566
def search(x, seq): for i, elem in enumerate(seq): if elem == None: return 0 elif x <= elem: return i elif i == (len(seq)-1): return i+1 else: continue
./refactory/data/question_1/code/wrong/wrong_1_566.py
refactory_data_question_1_wrong_1_561
def search(x, seq): if seq==[] or seq==(): return 0 elif x>=max(seq): return len(seq) else: for i in range(len(seq)): if x<=seq[i]: return i break else: continue
./refactory/data/question_1/code/wrong/wrong_1_561.py
refactory_data_question_1_wrong_1_150
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/wrong/wrong_1_150.py
refactory_data_question_1_wrong_1_340
def search(x, seq): counter = 0 for counter in range(len(seq)): if x <= seq[counter]: return counter elif x > seq[counter] and counter == len(seq) - 1: return len(seq) elif x > seq[counter]: counter = counter + 1
./refactory/data/question_1/code/wrong/wrong_1_340.py
refactory_data_question_1_wrong_1_499
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 0 elif x > seq[len(seq)-1]: return len(seq) else: i = 0 while i <= len(seq)-1: if x <= seq[i]: return i elif x > seq[i]: i += 1
./refactory/data/question_1/code/wrong/wrong_1_499.py
refactory_data_question_1_wrong_1_103
def search(x, seq): if seq == (): return () 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/wrong/wrong_1_103.py
refactory_data_question_1_wrong_1_236
def search(x, seq): if x < seq[0]: return 0 elif x > seq[-1]: return len(seq) else: for i in seq: if x > i: continue else: return seq.index(i)
./refactory/data/question_1/code/wrong/wrong_1_236.py
refactory_data_question_1_wrong_1_478
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 if x > seq[-1]: return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_478.py
refactory_data_question_1_wrong_1_200
def search(x, seq): 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,) + seq[i:] elif x < elem and type(seq) == list: seq = seq[:i] + [x,] + seq[i:] elif x > seq[-1]: if type(seq) == tuple: seq += (x,) elif type(seq) == list: seq += [x,] return seq.index(x)
./refactory/data/question_1/code/wrong/wrong_1_200.py
refactory_data_question_1_wrong_1_223
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/wrong/wrong_1_223.py
refactory_data_question_1_wrong_1_473
def search(x, seq): if seq == (): 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_473.py
refactory_data_question_1_wrong_1_447
def search(x, seq): for i in seq: if x<i: return i return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_447.py
refactory_data_question_1_wrong_1_513
def search(x, seq): Index = 0 for i in range(0,len(seq)+1): Index = i if int(x) < seq[0]: return 0 elif int(x)> seq[len(seq)-1]: return len(seq) elif int(x) > seq[i]: continue return Index
./refactory/data/question_1/code/wrong/wrong_1_513.py
refactory_data_question_1_wrong_1_480
def search(x, seq): 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/wrong/wrong_1_480.py
refactory_data_question_1_wrong_1_265
def search(x, seq): if seq[len(seq)-1] < x: return len(seq) elif seq[0] >= x or seq == () or seq == []: return 0 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/wrong/wrong_1_265.py
refactory_data_question_1_wrong_1_467
def search(x, seq): if seq == [] or seq == (): return 0 elif len(seq) == 1: if seq[0] < x: return 0 else: return 1 elif seq[-1] <= x: return len(seq) elif seq[0] >= x: 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/wrong/wrong_1_467.py
refactory_data_question_1_wrong_1_438
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: if i < x: lst.append(i) else: lst.append(x) continue return len(lst) - 1
./refactory/data/question_1/code/wrong/wrong_1_438.py
refactory_data_question_1_wrong_1_061
def search(x, seq): for i in seq: if len(seq) == 0: return 0 elif x <= i: return seq.index(i) elif x > max(seq): return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_061.py
refactory_data_question_1_wrong_1_321
def search(x, seq): for i, elem in enumerate(seq): if x <= elem: return i elif x > max(seq): return 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_321.py
refactory_data_question_1_wrong_1_491
def search(x, seq): l=len(seq) 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/wrong/wrong_1_491.py
refactory_data_question_1_wrong_1_440
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: counter = 0 for i in seq: if i < x: counter = counter + 1 return counter
./refactory/data/question_1/code/wrong/wrong_1_440.py
refactory_data_question_1_wrong_1_077
def search(x, seq): if seq: for i in range(len(seq)): pos = len(seq) if x <= seq[i]: pos = i break return pos else: return seq
./refactory/data/question_1/code/wrong/wrong_1_077.py
refactory_data_question_1_wrong_1_188
def search(x, seq): if seq ==[]: return 0 if x<0: return 0 elif x<max(seq): for i in range(len(seq)): if (x>=seq[i]) and (x<=seq[i+1]): return i+1 else: return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_188.py
refactory_data_question_1_wrong_1_494
def search(x, seq): if seq == () or []: return None else: for i, elem in enumerate (seq): if x<=elem: return i elif x>seq[-1]: return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_494.py
refactory_data_question_1_wrong_1_076
def search(x, seq): if seq: for i in range(len(seq)): pos = len(seq) if x <= seq[i]: pos = i break return pos else: return seq
./refactory/data/question_1/code/wrong/wrong_1_076.py
refactory_data_question_1_wrong_1_175
def search(x, seq): if list(seq) == (): return 0 elif 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_175.py
refactory_data_question_1_wrong_1_344
def search(x, seq): for i in range(len(seq)): if seq == (): 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_344.py
refactory_data_question_1_wrong_1_496
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 """ length = len(seq) for i, elem in enumerate(seq): if x < elem: return i else: if x == elem: return i if (i == length-1): return i+1
./refactory/data/question_1/code/wrong/wrong_1_496.py
refactory_data_question_1_wrong_1_571
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 == []: return 0 if x < seq[0]: return 0 elif x > seq[len(seq)-1]: return len(seq) else: for i in range(len(seq)-1): if seq[i] == x: return i+1 elif seq[i] < x and seq[i+1] > x: return i+1 else: return None
./refactory/data/question_1/code/wrong/wrong_1_571.py
refactory_data_question_1_wrong_1_035
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-1 else: return i
./refactory/data/question_1/code/wrong/wrong_1_035.py
refactory_data_question_1_wrong_1_156
def search(x, seq): for a,b in enumerate(seq): if eq==[]: return a if x<=b: return a for i in seq: if x>i: return a+1
./refactory/data/question_1/code/wrong/wrong_1_156.py
refactory_data_question_1_wrong_1_271
def search(x, seq): position = 0 while position < len(seq)-1: if seq[position] == x: break elif seq[position] > x: break position = position + 1 if seq[position] < x: position = position + 1 return position
./refactory/data/question_1/code/wrong/wrong_1_271.py
refactory_data_question_1_wrong_1_030
def search(x, seq): for i in range(len(seq)): if x<=seq[i]: return i elif x>seq[len(seq)]: return len(seq) elif len(seq)==0: return 0 else: continue
./refactory/data/question_1/code/wrong/wrong_1_030.py
refactory_data_question_1_wrong_1_215
def search(x, seq): if seq == []: return 0 elif x<seq[0]: return 0 elif x>seq[0] and len(seq) == 1: return 1 else: for i in range(len(seq)-1): if seq[i] <= x <= seq[i+1]: return i+1 return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_215.py
refactory_data_question_1_wrong_1_132
def search(x, seq): 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/wrong/wrong_1_132.py
refactory_data_question_1_wrong_1_385
def search(x, seq): for i in range(len(seq)): if seq[i] < x: continue elif seq[len(seq)] < x: return len(seq) 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_385.py
refactory_data_question_1_wrong_1_062
def search(x, seq): if type(seq) == tuple: seq = list(seq) seq.append(x) sorted(seq) seq.index(x)
./refactory/data/question_1/code/wrong/wrong_1_062.py
refactory_data_question_1_wrong_1_348
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, x in seq: if x < seq[i]: return i return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_348.py
refactory_data_question_1_wrong_1_155
def search(x, seq): if 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/wrong/wrong_1_155.py
refactory_data_question_1_wrong_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 """ largest=seq[0] for i in range(len(seq)): if seq==() or seq==[]: return 0 if x<=seq[i]: return i elif x>seq[len(seq)-1]: return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_353.py
refactory_data_question_1_wrong_1_008
def search(x, seq): if seq == () or seq == []: return 0 elif x <= seq[0]: return 0 elif x >= seq[-1]: return len(seq) - 1 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_008.py
refactory_data_question_1_wrong_1_216
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 if i == (len(seq)-1): return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_216.py
refactory_data_question_1_wrong_1_251
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_251.py
refactory_data_question_1_wrong_1_211
def search(x, seq): if not seq: return 0 elif x < seq[0]: return 0 elif x > seq[-1]: return 0 else: for i in range(len(seq) - 1): if seq[i] == x: return i elif seq[i] < x < seq[i+1]: return i+1
./refactory/data/question_1/code/wrong/wrong_1_211.py
refactory_data_question_1_wrong_1_092
def search(x, seq): if seq == () or seq == []: return 0 else: count = 0 for i in range (0, len(seq)): if seq[i] > x: return i elif seq[-1] < x: return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_092.py
refactory_data_question_1_wrong_1_310
def search(x, seq): for i in range(seq): if x<=seq[i]: break return i
./refactory/data/question_1/code/wrong/wrong_1_310.py
refactory_data_question_1_wrong_1_217
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 == (): return 0 for i, elem in enumerate(seq): if x <= elem: return i if i == (len(seq)-1): return len(seq)
./refactory/data/question_1/code/wrong/wrong_1_217.py