id
stringlengths 35
39
| content
stringlengths 44
3.85k
| max_stars_repo_path
stringlengths 52
57
|
|---|---|---|
refactory_data_question_1_correct_1_648
|
def search(x, seq):
for i, ele in enumerate(seq):
if x <= ele:
return i
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_648.py
|
refactory_data_question_1_correct_1_275
|
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_275.py
|
refactory_data_question_1_correct_1_190
|
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_190.py
|
refactory_data_question_1_correct_1_309
|
def search(x, seq):
result = 0
for i in range(len(seq)):
if x > seq[i]:
result += 1
return result
|
./refactory/data/question_1/code/correct/correct_1_309.py
|
refactory_data_question_1_correct_1_352
|
def search(x, seq):
if seq == () or seq == []:
return 0
else:
for i, elem in enumerate(seq):
if x <= elem:
return i
elif i == len(seq) - 1 and x > elem:
return i + 1
|
./refactory/data/question_1/code/correct/correct_1_352.py
|
refactory_data_question_1_correct_1_177
|
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
elif seq[a-1] < x < seq[a]:
return a
else:
if x > seq[-1]:
return len(seq)
elif x < seq[0]:
return 0
|
./refactory/data/question_1/code/correct/correct_1_177.py
|
refactory_data_question_1_correct_1_131
|
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_131.py
|
refactory_data_question_1_correct_1_762
|
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
break
elif x > elem:
continue
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_762.py
|
refactory_data_question_1_correct_1_144
|
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_144.py
|
refactory_data_question_1_correct_1_289
|
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_289.py
|
refactory_data_question_1_correct_1_283
|
def search(x, seq):
counter=0
while counter<len(seq):
if seq[counter]>=x:
return counter
counter+=1
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_283.py
|
refactory_data_question_1_correct_1_573
|
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_573.py
|
refactory_data_question_1_correct_1_482
|
def search(x, seq):
count=0
for i in range (len(seq)):
if x<=seq[i]:
break
count +=1
return count
|
./refactory/data/question_1/code/correct/correct_1_482.py
|
refactory_data_question_1_correct_1_138
|
def search(x, seq):
if len(seq)==0:
return 0
for i in range(0,len(seq)):
if x<seq[i]:
return i
elif x==seq[i]:
return i
elif x>seq[len(seq)-1]:
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_138.py
|
refactory_data_question_1_correct_1_058
|
def search(x, seq):
lst = list(seq)
if lst == []:
lst.append(x)
else:
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/correct/correct_1_058.py
|
refactory_data_question_1_correct_1_669
|
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_669.py
|
refactory_data_question_1_correct_1_176
|
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_176.py
|
refactory_data_question_1_correct_1_382
|
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
else:
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_382.py
|
refactory_data_question_1_correct_1_425
|
def search(x, seq):
for i, val in enumerate(seq):
if x <= val:
return i
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_425.py
|
refactory_data_question_1_correct_1_605
|
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_605.py
|
refactory_data_question_1_correct_1_701
|
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_701.py
|
refactory_data_question_1_correct_1_755
|
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_755.py
|
refactory_data_question_1_correct_1_209
|
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_209.py
|
refactory_data_question_1_correct_1_105
|
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_105.py
|
refactory_data_question_1_correct_1_454
|
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_454.py
|
refactory_data_question_1_correct_1_247
|
def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
for index in range(len(seq)):
if x<= seq[index]:
return index
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_247.py
|
refactory_data_question_1_correct_1_661
|
def search(x, seq):
a = len(seq)
for i, elem in enumerate(seq):
if x <= elem:
return i
return a
|
./refactory/data/question_1/code/correct/correct_1_661.py
|
refactory_data_question_1_correct_1_421
|
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_421.py
|
refactory_data_question_1_correct_1_543
|
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_543.py
|
refactory_data_question_1_correct_1_476
|
def search(x, seq):
if seq==[]:
return 0
elif seq==():
return 0
else:
for i,v in enumerate(seq):
if x>v and i!=len(seq)-1:
continue
elif x>v and i==len(seq)-1:
return i+1
else:
break
return i
|
./refactory/data/question_1/code/correct/correct_1_476.py
|
refactory_data_question_1_correct_1_621
|
def search(x, seq):
for i, ele in enumerate(seq):
if x <= ele:
return i
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_621.py
|
refactory_data_question_1_correct_1_324
|
def search(x, seq):
if not seq:
return 0
elif x> seq[-1]:
return len(seq)
for i, elem in enumerate(seq):
if x<=elem:
break
return i
|
./refactory/data/question_1/code/correct/correct_1_324.py
|
refactory_data_question_1_correct_1_020
|
def search(x, seq):
""" Takes in a value x and a sorted sequence seq, and returns the
position that x should go to such that the sequence remains sorted """
for index, value in enumerate(seq):
if x <= value:
return index
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_020.py
|
refactory_data_question_1_correct_1_004
|
def search(x, seq):
index = 0
for i in range(0,len(seq)):
if x > seq[i]:
index = i + 1
return index
|
./refactory/data/question_1/code/correct/correct_1_004.py
|
refactory_data_question_1_correct_1_627
|
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_627.py
|
refactory_data_question_1_correct_1_453
|
def search(x, seq):
for i in range(len(seq)):
if seq[0]>0 and x<0:
return 0
elif x==seq[i] or x<seq[i]:
return i
else:
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_453.py
|
refactory_data_question_1_correct_1_237
|
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 sequence
return len(seq)
elif x <= seq[i]: #to return the number when x is smaller of equals to the i in the loop
return i
else:
continue #goes into a loop until it finds the number that matches the previous answer.
|
./refactory/data/question_1/code/correct/correct_1_237.py
|
refactory_data_question_1_correct_1_684
|
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_684.py
|
refactory_data_question_1_correct_1_257
|
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_257.py
|
refactory_data_question_1_correct_1_436
|
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_436.py
|
refactory_data_question_1_correct_1_443
|
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 > max(seq):
return len(seq)
else:
enumerated = list(enumerate(seq))
for i in range(len(enumerated)):
if enumerated[i][1] >= x:
return enumerated[i][0]
break
|
./refactory/data/question_1/code/correct/correct_1_443.py
|
refactory_data_question_1_correct_1_732
|
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_732.py
|
refactory_data_question_1_correct_1_452
|
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_452.py
|
refactory_data_question_1_correct_1_043
|
def search(x, seq):
n=len(seq)
count=0
for i in range(n):
if seq[i]<x:
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 """
|
./refactory/data/question_1/code/correct/correct_1_043.py
|
refactory_data_question_1_correct_1_234
|
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_234.py
|
refactory_data_question_1_correct_1_491
|
def search(x, seq):
position = 0
for element in seq:
if x <= element:
return position
else:
position += 1
return position
|
./refactory/data/question_1/code/correct/correct_1_491.py
|
refactory_data_question_1_correct_1_146
|
def search(x, seq):
if len(seq)==0:
return 0
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/correct/correct_1_146.py
|
refactory_data_question_1_correct_1_713
|
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_713.py
|
refactory_data_question_1_correct_1_465
|
def search(x, seq):
if len(seq)==0:
return 0
elif x<seq[0]:
return 0
elif x>seq[-1]:
return len(seq)
else:
for i in range(len(seq)):
if x>seq[i] and x<seq[i+1]:
return i+1
elif x==seq[i]:
return i
|
./refactory/data/question_1/code/correct/correct_1_465.py
|
refactory_data_question_1_correct_1_508
|
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_508.py
|
refactory_data_question_1_correct_1_022
|
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_022.py
|
refactory_data_question_1_correct_1_730
|
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_730.py
|
refactory_data_question_1_correct_1_371
|
def search(x, seq):
if len(seq) == 0:
return 0
elif x <= seq[-1]:
for i in range(len(seq)):
if seq[i] < x:
continue
else:
return i
else:
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_371.py
|
refactory_data_question_1_correct_1_139
|
def search(x, seq):
counter=0
while counter<len(seq):
if seq[counter]>=x:
return counter
counter+=1
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_139.py
|
refactory_data_question_1_correct_1_455
|
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_455.py
|
refactory_data_question_1_correct_1_363
|
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_363.py
|
refactory_data_question_1_correct_1_053
|
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 """
index_for_x = 0
for index, element in enumerate(seq) :
if element < x:
index_for_x+=1
else:
break
return index_for_x
|
./refactory/data/question_1/code/correct/correct_1_053.py
|
refactory_data_question_1_correct_1_117
|
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_117.py
|
refactory_data_question_1_correct_1_687
|
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_687.py
|
refactory_data_question_1_correct_1_766
|
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
break
elif x > elem:
continue
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_766.py
|
refactory_data_question_1_correct_1_293
|
def search(x, seq):
r=0
for i in seq:
if x>i:
r+=1
return r
|
./refactory/data/question_1/code/correct/correct_1_293.py
|
refactory_data_question_1_correct_1_507
|
def search(x, seq):
if len(seq)==0:
return 0
if x <= seq[0]:
return 0
for i in range(len(seq)-1):
if seq[i+1]>=x and x>seq[i]:
return i+1
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_507.py
|
refactory_data_question_1_correct_1_580
|
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_580.py
|
refactory_data_question_1_correct_1_536
|
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_536.py
|
refactory_data_question_1_correct_1_463
|
def search(x, seq):
lst = []
for i, elem in enumerate(seq):
lst.append((i, elem))
for i in lst:
if x <= i[1]:
return i[0]
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_463.py
|
refactory_data_question_1_correct_1_059
|
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_059.py
|
refactory_data_question_1_correct_1_074
|
def search(x, seq):
counter = 0
for elem in seq:
if x > elem:
counter += 1
else:
break
return counter
|
./refactory/data/question_1/code/correct/correct_1_074.py
|
refactory_data_question_1_correct_1_299
|
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
for num in seq:
if x>num:
n +=1
else:
return n
return n
|
./refactory/data/question_1/code/correct/correct_1_299.py
|
refactory_data_question_1_correct_1_400
|
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_400.py
|
refactory_data_question_1_correct_1_570
|
def search(x,seq):
for i, elem in enumerate(seq):
if x <= elem:
return i
else:
continue
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_570.py
|
refactory_data_question_1_correct_1_749
|
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_749.py
|
refactory_data_question_1_correct_1_061
|
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_061.py
|
refactory_data_question_1_correct_1_046
|
def search(x, seq):
if not seq:
return 0
else:
for i in range(len(seq)):
if x<=seq[i]:
return i
return i+1
|
./refactory/data/question_1/code/correct/correct_1_046.py
|
refactory_data_question_1_correct_1_130
|
def search(x,seq):
counter = 0
for i in seq:
if i < x:
counter = counter + 1
return counter
|
./refactory/data/question_1/code/correct/correct_1_130.py
|
refactory_data_question_1_correct_1_724
|
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_724.py
|
refactory_data_question_1_correct_1_518
|
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
|
./refactory/data/question_1/code/correct/correct_1_518.py
|
refactory_data_question_1_correct_1_372
|
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_372.py
|
refactory_data_question_1_correct_1_590
|
def search(x, seq):
if len(seq) == 0:
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/correct/correct_1_590.py
|
refactory_data_question_1_correct_1_012
|
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,e in enumerate(seq):
if x <= e:
return i
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_012.py
|
refactory_data_question_1_correct_1_267
|
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_267.py
|
refactory_data_question_1_correct_1_651
|
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_651.py
|
refactory_data_question_1_correct_1_063
|
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_063.py
|
refactory_data_question_1_correct_1_035
|
def search(x, seq):
if not seq:
return 0
elif x <= seq[0]:
return 0
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/correct/correct_1_035.py
|
refactory_data_question_1_correct_1_764
|
def search(x, seq):
n = 0
for i in seq:
if x <= i:
return n
else:
n += 1
return n
|
./refactory/data/question_1/code/correct/correct_1_764.py
|
refactory_data_question_1_correct_1_227
|
def search(x, seq):
counter = 0
for i in seq:
if i< x:
counter += 1
elif i == x or i>x:
break
return counter
|
./refactory/data/question_1/code/correct/correct_1_227.py
|
refactory_data_question_1_correct_1_431
|
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_431.py
|
refactory_data_question_1_correct_1_650
|
def search(x,seq):
counter = 0
for i in seq:
if i < x:
counter = counter + 1
return counter
|
./refactory/data/question_1/code/correct/correct_1_650.py
|
refactory_data_question_1_correct_1_122
|
def search(x, seq):
if len(seq)==0:
return 0
elif x<seq[0]:
return 0
elif x>seq[-1]:
return len(seq)
else:
for i in range(len(seq)):
if x>seq[i] and x<seq[i+1]:
return i+1
elif x==seq[i]:
return i
|
./refactory/data/question_1/code/correct/correct_1_122.py
|
refactory_data_question_1_correct_1_253
|
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_253.py
|
refactory_data_question_1_correct_1_369
|
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_369.py
|
refactory_data_question_1_correct_1_539
|
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_539.py
|
refactory_data_question_1_correct_1_115
|
def search(x, seq):
if len(seq)==0:
return 0
a = list(enumerate(seq))
for item in a:
if x <= item[1]:
return item[0]
if x > seq[-1]:
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_115.py
|
refactory_data_question_1_correct_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 """
count = 0
for i in seq:
if x > i:
count = count + 1
return count
|
./refactory/data/question_1/code/correct/correct_1_531.py
|
refactory_data_question_1_correct_1_351
|
def search(x, seq):
for i in range(len(seq)):
if x <= seq[i]:
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_351.py
|
refactory_data_question_1_correct_1_149
|
def search(x, seq):
new_seq=[]
position=0
for i in range(len(seq)):
if x>seq[i]:
position+=1
return position
|
./refactory/data/question_1/code/correct/correct_1_149.py
|
refactory_data_question_1_correct_1_067
|
def search(x, seq):
if len(seq) == 0:
return 0
else:
for i,elem in enumerate(seq):
if x > elem:
continue
return i
return i+1
|
./refactory/data/question_1/code/correct/correct_1_067.py
|
refactory_data_question_1_correct_1_291
|
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 enumerate(seq):
if x <= i[1]:
return i[0]
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_291.py
|
refactory_data_question_1_correct_1_086
|
def search(x, seq):
holder=0
for value in seq:
if x>value:
holder+=1
return holder
|
./refactory/data/question_1/code/correct/correct_1_086.py
|
refactory_data_question_1_correct_1_475
|
def search(x, seq):
if seq==[]:
return 0
elif seq==():
return 0
else:
for i,v in enumerate(seq):
if x>v and i!=len(seq)-1:
continue
elif x>v and i==len(seq)-1:
return i+1
else:
break
return i
|
./refactory/data/question_1/code/correct/correct_1_475.py
|
refactory_data_question_1_correct_1_495
|
def search(x, seq):
for i in range(len(seq)):
if x<=seq[i]:
return i
break
else:
continue
return len(seq)
|
./refactory/data/question_1/code/correct/correct_1_495.py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.