id
stringlengths 35
39
| content
stringlengths 44
3.85k
| max_stars_repo_path
stringlengths 52
57
|
|---|---|---|
refactory_data_question_1_wrong_1_457
|
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/wrong/wrong_1_457.py
|
refactory_data_question_1_wrong_1_329
|
def search(x, seq):
for i in range(len(seq)):
if x <= seq(i):
return i
elif x > seq[-1]:
return len(seq) + 1
|
./refactory/data/question_1/code/wrong/wrong_1_329.py
|
refactory_data_question_1_wrong_1_219
|
def search(x, seq):
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/wrong/wrong_1_219.py
|
refactory_data_question_1_wrong_1_053
|
def search(x, seq):
if seq == () or seq == []:
return None
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/wrong/wrong_1_053.py
|
refactory_data_question_1_wrong_1_528
|
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 = -1
for i in seq:
if len(seq) == 0:
return 0
if x <= i:
counter += 1
return counter
else:
counter += 1
if x > seq[counter]:
return counter + 1
|
./refactory/data/question_1/code/wrong/wrong_1_528.py
|
refactory_data_question_1_wrong_1_454
|
def search(x, seq):
for i in range(len(seq)):
if seq[i] >= x:
return i
else:
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/wrong/wrong_1_454.py
|
refactory_data_question_1_wrong_1_548
|
def search(x, seq):
if seq == tuple():
return 'empty'
for i, elem in enumerate(seq):
if x <= elem:
return i
return i+1
|
./refactory/data/question_1/code/wrong/wrong_1_548.py
|
refactory_data_question_1_wrong_1_145
|
def search(x, seq):
n=[]
seq = list(seq)
a= seq.copy()
d = 0
for i in a:
if a == ():
return 0
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_145.py
|
refactory_data_question_1_wrong_1_433
|
def search(x, seq):
for i in range(len(seq)-1):
if x <= seq[i]:
return i
else:
return len(seq)
|
./refactory/data/question_1/code/wrong/wrong_1_433.py
|
refactory_data_question_1_wrong_1_483
|
def search(x, seq):
for i in range(len(seq)):
if seq[i] > x:
seq.insert(x, i)
return 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
|
./refactory/data/question_1/code/wrong/wrong_1_483.py
|
refactory_data_question_1_wrong_1_357
|
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 new_seq[i]<=x:
sort.append(new_seq[i])
else:
sort.append(x)
sort.extend(new_seq[i:])
break
return sort
else:
sort = []
for i in range(len(seq)):
if seq[i]<=x:
sort.append(seq[i])
else:
sort.append(x)
sort.extend(seq[i:])
break
return sort
|
./refactory/data/question_1/code/wrong/wrong_1_357.py
|
refactory_data_question_1_wrong_1_109
|
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_109.py
|
refactory_data_question_1_wrong_1_069
|
def search(x, seq):
for i, elem in enumerate(seq):
if seq == ():
return 0
elif x == elem:
return i
elif x < elem:
return i
elif x > seq[-1]:
return len(seq)
|
./refactory/data/question_1/code/wrong/wrong_1_069.py
|
refactory_data_question_1_wrong_1_541
|
def search(x, seq):
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_541.py
|
refactory_data_question_1_wrong_1_048
|
def search(x, seq):
if len(seq) == 0:
return False
else:
for i in range(len(seq)):
if x < seq[i]:
return i
elif seq[i]<x:
return i+1
|
./refactory/data/question_1/code/wrong/wrong_1_048.py
|
refactory_data_question_1_wrong_1_575
|
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
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_575.py
|
refactory_data_question_1_wrong_1_050
|
def search(x, seq):
for i in range(len(seq)):
if x < seq[i]:
return i
elif seq[i] == seq[-1] and seq[i]<x:
return i+1
elif seq[i]<x<=seq[i+1]:
return i+1
|
./refactory/data/question_1/code/wrong/wrong_1_050.py
|
refactory_data_question_1_wrong_1_550
|
def search(x, seq):
if seq is ():
return 'not found'
for i, elem in enumerate(seq):
if x <= elem:
return i
return i+1
|
./refactory/data/question_1/code/wrong/wrong_1_550.py
|
refactory_data_question_1_wrong_1_560
|
def search(x, seq):
if 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_560.py
|
refactory_data_question_1_wrong_1_368
|
def search(x, seq):
lst1 = list(seq)
length = len(lst1)
lst2 = []
if x < seq[0]:
lst2 = [x] + lst1
elif x > seq[length -1]:
lst2 = lst1 + [x]
else:
for i in range(0, length):
if seq[i] <= x <= seq[i+1]:
lst2 = lst1[:i+1] + [x] + lst1[i+1:]
print(lst2)
for i in range(len(lst2)):
if x == lst2[i]:
return i
|
./refactory/data/question_1/code/wrong/wrong_1_368.py
|
refactory_data_question_1_wrong_1_246
|
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/wrong/wrong_1_246.py
|
refactory_data_question_1_wrong_1_278
|
def search(x, seq):
if 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/wrong/wrong_1_278.py
|
refactory_data_question_1_wrong_1_129
|
def search(x, seq):
if x <= seq[0] or not seq:
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/wrong/wrong_1_129.py
|
refactory_data_question_1_wrong_1_054
|
def search(x, seq):
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/wrong/wrong_1_054.py
|
refactory_data_question_1_wrong_1_238
|
def search(x, seq):
if list(seq) == []:
return 0
else:
for element in seq:
if x <= element:
return list(seq).index(element)
elif x == element:
return (list(seq).index(element))-1
elif x >= max(seq):
return (list(seq).index(max(seq)))+1
|
./refactory/data/question_1/code/wrong/wrong_1_238.py
|
refactory_data_question_1_wrong_1_509
|
def search(x, seq):
if x>seq[len(seq)-1]:
return len(seq)
for i in range(len(seq)):
if x>seq[i]:
continue
return i
|
./refactory/data/question_1/code/wrong/wrong_1_509.py
|
refactory_data_question_1_wrong_1_086
|
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_086.py
|
refactory_data_question_1_wrong_1_023
|
def search(x, seq):
if x < int(seq[0]):
return 0
elif x > int(seq[len(seq)-1]):
return len(seq)
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_023.py
|
refactory_data_question_1_wrong_1_328
|
def search(x, seq):
if seq == ():
return None
elif seq == []:
return None
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/wrong/wrong_1_328.py
|
refactory_data_question_1_wrong_1_286
|
def search(x, seq):
if x<seq[0]:
return 0
elif x>seq[-1]:
return len(seq)
else:
for i in range(len(seq)-1):
if x>seq[i] and x<seq[i+1]:
return i+1
elif x==seq[i]:
return i
|
./refactory/data/question_1/code/wrong/wrong_1_286.py
|
refactory_data_question_1_wrong_1_009
|
def search(x, seq):
for i, elem in enumerate(seq):
if elem < x < elem + 1:
return i + 1
|
./refactory/data/question_1/code/wrong/wrong_1_009.py
|
refactory_data_question_1_wrong_1_193
|
def search(x, seq):
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/wrong/wrong_1_193.py
|
refactory_data_question_1_wrong_1_360
|
def search(x, seq):
if x <= seq[0]:
return 0
elif x >= seq[-1]:
return len(seq)
elif len(seq) == 0:
return 0
else:
for i in range(0, len(seq)-1):
if seq[i] <= x <= seq[i+1]:
return i+1
|
./refactory/data/question_1/code/wrong/wrong_1_360.py
|
refactory_data_question_1_wrong_1_014
|
def search(x, seq):
if x < seq[0]:
return 0
elif x > seq[-1]:
return len(seq)
|
./refactory/data/question_1/code/wrong/wrong_1_014.py
|
refactory_data_question_1_wrong_1_071
|
def search(x, seq):
if 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/wrong/wrong_1_071.py
|
refactory_data_question_1_wrong_1_242
|
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 seq:
if x < seq[i]:
return i
|
./refactory/data/question_1/code/wrong/wrong_1_242.py
|
refactory_data_question_1_wrong_1_396
|
def search(x, seq):
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_396.py
|
refactory_data_question_1_wrong_1_458
|
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/wrong/wrong_1_458.py
|
refactory_data_question_1_wrong_1_074
|
def search(x, seq):
for i in seq:
if x<i:
return seq.index(i)
elif x == i:
return seq.index(i)
elif x>seq[-1]:
return (seq.index(seq[-1]))+1
|
./refactory/data/question_1/code/wrong/wrong_1_074.py
|
refactory_data_question_1_wrong_1_043
|
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
return len(seq)+1
|
./refactory/data/question_1/code/wrong/wrong_1_043.py
|
refactory_data_question_1_wrong_1_367
|
def search(x, seq):
if seq==():
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/wrong/wrong_1_367.py
|
refactory_data_question_1_wrong_1_389
|
def search(x, seq):
lst1 = list(seq)
if seq == () or seq ==[]:
return 0
else:
length = len(lst1)
lst2 = []
if x < seq[0]:
lst2 = [x] + lst1
elif x > seq[length -1]:
lst2 = lst1 + [x]
else:
for i in range(0, length):
if seq[i] <= x <= seq[i+1]:
lst2 = lst1[:i+1] + [x] + lst1[i+1:]
for i in range(len(lst2)):
if x == lst2[i]:
return i
|
./refactory/data/question_1/code/wrong/wrong_1_389.py
|
refactory_data_question_1_wrong_1_309
|
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 None
|
./refactory/data/question_1/code/wrong/wrong_1_309.py
|
refactory_data_question_1_wrong_1_029
|
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)
elif len(seq)==0:
return 0
else:
continue
|
./refactory/data/question_1/code/wrong/wrong_1_029.py
|
refactory_data_question_1_wrong_1_547
|
def search(x, seq):
if seq == ():
return 'empty'
for i, elem in enumerate(seq):
if x <= elem:
return i
return i+1
|
./refactory/data/question_1/code/wrong/wrong_1_547.py
|
refactory_data_question_1_wrong_1_144
|
def search(x, seq):
n=[]
seq = list(seq)
a= seq.copy()
d = 0
if seq == () or []:
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_144.py
|
refactory_data_question_1_wrong_1_532
|
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_532.py
|
refactory_data_question_1_wrong_1_210
|
def search(x, seq):
if x < seq[0]:
return 0
elif x > seq[-1]:
return len(seq)
elif len(seq) == 0:
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_210.py
|
refactory_data_question_1_wrong_1_332
|
def search(x, seq):
for i in range(len(seq)):
if x <= seq[i]:
return i
|
./refactory/data/question_1/code/wrong/wrong_1_332.py
|
refactory_data_question_1_wrong_1_120
|
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 elem >= x:
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 """
return
|
./refactory/data/question_1/code/wrong/wrong_1_120.py
|
refactory_data_question_1_wrong_1_540
|
def search(x, seq):
if seq==[]:
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/wrong/wrong_1_540.py
|
refactory_data_question_1_wrong_1_197
|
def search(x, seq):
count=0
while count<len(seq):
if x>seq[count]:
count+=1
continue
else:
if count!=0:
return count-1
else:
return 0
return len(seq)
|
./refactory/data/question_1/code/wrong/wrong_1_197.py
|
refactory_data_question_1_wrong_1_427
|
def search(x,seq):
for i,elem in enumerate(seq):
if x <= elem:
return i
else:
return len(seq)
|
./refactory/data/question_1/code/wrong/wrong_1_427.py
|
refactory_data_question_1_wrong_1_282
|
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)
elif seq == ():
return None
|
./refactory/data/question_1/code/wrong/wrong_1_282.py
|
refactory_data_question_1_wrong_1_122
|
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 elem > x:
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_122.py
|
refactory_data_question_1_wrong_1_073
|
def search(x, seq):
for i in range(len(seq)):
if x<= seq[i]:
a=i
break
elif x> seq[len(seq)-1]:
a=len(seq)
return a
|
./refactory/data/question_1/code/wrong/wrong_1_073.py
|
refactory_data_question_1_wrong_1_554
|
def search(x, seq):
if seq == ():
return -1
for i, elem in enumerate(seq):
if x <= elem:
return i
return i+1
|
./refactory/data/question_1/code/wrong/wrong_1_554.py
|
refactory_data_question_1_wrong_1_042
|
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
return len(seq)+1
|
./refactory/data/question_1/code/wrong/wrong_1_042.py
|
refactory_data_question_1_wrong_1_186
|
def search(x, seq):
count==0
while count<len(seq):
if seq[count]<x:
count+=1
return count
|
./refactory/data/question_1/code/wrong/wrong_1_186.py
|
refactory_data_question_1_wrong_1_382
|
def search(x, seq):
for i in range(len(seq)):
if seq[i] < x:
continue
elif seq[len(seq)] < x:
return len(seq)+1
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_382.py
|
refactory_data_question_1_wrong_1_220
|
def search(x, seq):
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/wrong/wrong_1_220.py
|
refactory_data_question_1_wrong_1_537
|
def search(x, seq):
for i in range(len(seq)):
if seq[i]>x:
break
return i
|
./refactory/data/question_1/code/wrong/wrong_1_537.py
|
refactory_data_question_1_wrong_1_486
|
def search(x, seq):
result = 0
for i in range(len(seq)):
if seq[i] >= x:
result = i
break
return result
|
./refactory/data/question_1/code/wrong/wrong_1_486.py
|
refactory_data_question_1_wrong_1_102
|
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_102.py
|
refactory_data_question_1_wrong_1_323
|
def search(x, seq):
for i, elem in enumerate(seq):
if seq == ():
return 0
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/wrong/wrong_1_323.py
|
refactory_data_question_1_wrong_1_304
|
def search(x, seq):
if type(seq) == list:
a = seq.copy()
a.append(x)
a.sort()
for i, elem in enumerate(a):
if elem == x:
return i
else:
temp_tuple = seq.copy()
temp_tuple+=(x,)
for i, elem in enumerate(sorted(temp_tuple)):
if elem == x:
return i
|
./refactory/data/question_1/code/wrong/wrong_1_304.py
|
refactory_data_question_1_wrong_1_196
|
def search(x, seq):
for i, elem in enumerate(seq):
if seq == ():
return (i,)
elif seq == []:
return [i]
elif x <= elem:
return i
elif x > seq[len(seq)-1]:
return len(seq)
|
./refactory/data/question_1/code/wrong/wrong_1_196.py
|
refactory_data_question_1_wrong_1_333
|
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/wrong/wrong_1_333.py
|
refactory_data_question_1_wrong_1_519
|
def search(x, seq):
for i,elem in enumerate(seq):
if elem<x:
pos=i+1
elif elem>x:
pos=i
return pos
|
./refactory/data/question_1/code/wrong/wrong_1_519.py
|
refactory_data_question_1_wrong_1_208
|
def search(x, seq):
if x < seq[0]:
return 0
elif x > seq[-1]:
return len(seq)
elif seq == []:
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_208.py
|
refactory_data_question_1_wrong_1_464
|
def search(x, seq):
if 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_464.py
|
refactory_data_question_1_wrong_1_161
|
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_161.py
|
refactory_data_question_1_wrong_1_516
|
def search(x, seq):
if x >= seq[len(seq)-1]:
return len(seq)
else:
for i in range(len(seq)):
if x > seq[i]:
continue
else:
return i
|
./refactory/data/question_1/code/wrong/wrong_1_516.py
|
refactory_data_question_1_wrong_1_067
|
def search(x, seq):
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/wrong/wrong_1_067.py
|
refactory_data_question_1_wrong_1_428
|
def search(x, seq):
for i in seq:
if seq == () or seq == []:
return 0
elif x <= i:
return seq.index(i)
elif x > seq[-1]:
return (seq.index(seq[-1])) + 1
|
./refactory/data/question_1/code/wrong/wrong_1_428.py
|
refactory_data_question_1_wrong_1_435
|
def search(x,seq):
for i,elem in enumerate(seq):
counter = 0
if x<= elem:
counter = i
else:
counter = len(seq)
return counter
|
./refactory/data/question_1/code/wrong/wrong_1_435.py
|
refactory_data_question_1_wrong_1_452
|
def search(x, seq):
for i in range(len(seq)):
if seq[i] >= x:
return i
else:
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/wrong/wrong_1_452.py
|
refactory_data_question_1_wrong_1_313
|
def search(x, seq):
for i in range(len(seq)):
if len(seq)==0:
return 0
elif x<=seq[i]:
return i
return i+1
|
./refactory/data/question_1/code/wrong/wrong_1_313.py
|
refactory_data_question_1_wrong_1_572
|
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
|
./refactory/data/question_1/code/wrong/wrong_1_572.py
|
refactory_data_question_1_wrong_1_240
|
def search(x, seq):
n = len(seq)
for i in range(0,n):
currentvalue = seq[i]
position = i
if position >= 0 and x>currentvalue:
position = i+1
elif position >= 0 and x<= currentvalue:
return position
elif seq==():
return 0
return position
|
./refactory/data/question_1/code/wrong/wrong_1_240.py
|
refactory_data_question_1_wrong_1_311
|
def search(x, seq):
for i in range(len(seq)):
if x<=seq[i]:
break
return i
|
./refactory/data/question_1/code/wrong/wrong_1_311.py
|
refactory_data_question_1_wrong_1_553
|
def search(x, seq):
if seq == ():
return ()
for i, elem in enumerate(seq):
if x <= elem:
return i
return i+1
|
./refactory/data/question_1/code/wrong/wrong_1_553.py
|
refactory_data_question_1_wrong_1_100
|
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_100.py
|
refactory_data_question_1_wrong_1_460
|
def search(x, seq):
if 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_460.py
|
refactory_data_question_1_wrong_1_180
|
def search(x, seq):
for i, elem in enumerate(seq):
if seq == ():
return 0
elif x > seq[-1]:
return len(seq)
elif x > elem:
continue
else:
return i
|
./refactory/data/question_1/code/wrong/wrong_1_180.py
|
refactory_data_question_1_wrong_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
for i, x in enumerate(seq):
if x < seq[i]:
return i
return i
|
./refactory/data/question_1/code/wrong/wrong_1_350.py
|
refactory_data_question_1_wrong_1_559
|
def search(x, seq):
for i,elem in enumerate(seq):
if elem<x:
pos=i+1
elif elem>x:
pos=i
return pos
|
./refactory/data/question_1/code/wrong/wrong_1_559.py
|
refactory_data_question_1_wrong_1_455
|
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_455.py
|
refactory_data_question_1_wrong_1_134
|
def search(x, seq):
for i, elem in enumerate(seq):
if i == 0 and x < elem:
return 0
elif x == elem:
return i
elif x < elem:
return i
elif x > seq[-1]:
return len(seq)
|
./refactory/data/question_1/code/wrong/wrong_1_134.py
|
refactory_data_question_1_wrong_1_409
|
def search(x, seq):
for i, element in enumerate(seq):
if x < element:
return i
return len(seq)
|
./refactory/data/question_1/code/wrong/wrong_1_409.py
|
refactory_data_question_1_wrong_1_475
|
def search(x, seq):
if seq == () or []:
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_475.py
|
refactory_data_question_1_wrong_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 """
count = 0
if x <= seq[0] or seq == () or seq == []:
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/wrong/wrong_1_160.py
|
refactory_data_question_1_wrong_1_451
|
def search(x, seq):
for i in range(len(seq)):
if seq[i] < x:
continue
elif x <= seq[i]:
return i
else:
return len(seq)+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_451.py
|
refactory_data_question_1_wrong_1_194
|
def search(x, seq):
count=0
while count<len(seq):
if x>seq[count]:
count+=1
continue
else:
return count-1
return len(seq)
|
./refactory/data/question_1/code/wrong/wrong_1_194.py
|
refactory_data_question_1_wrong_1_183
|
def search(x, seq):
for i in seq:
if x>i:
continue
else:
return (seq.index(i))-1
|
./refactory/data/question_1/code/wrong/wrong_1_183.py
|
refactory_data_question_1_wrong_1_418
|
def search(x, seq):
for i in range(len(seq)-1):
if x >= seq[i] and x <= seq[i+1]:
break
return i
|
./refactory/data/question_1/code/wrong/wrong_1_418.py
|
refactory_data_question_1_wrong_1_140
|
def search(x, seq):
for i in range(len(seq)-1):
if seq[i] < x:
return i
return len(seq)
|
./refactory/data/question_1/code/wrong/wrong_1_140.py
|
refactory_data_question_1_wrong_1_019
|
def search(x, seq):
if x < seq[0]:
return 0
elif x > seq[-1]:
return len(seq)
elif seq == ():
return 0
for i, elem in enumerate(seq):
if x <= elem:
return i
|
./refactory/data/question_1/code/wrong/wrong_1_019.py
|
refactory_data_question_1_wrong_1_224
|
def search(x, seq):
for i in len(seq):
if x <= seq[i]:
return i
return len(seq)+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_224.py
|
refactory_data_question_1_wrong_1_551
|
def search(x, seq):
if seq == ():
return 0
if x>seq[len(seq)-1]:
return len(seq)
for i in range(len(seq)):
if x>seq[i]:
continue
return i
|
./refactory/data/question_1/code/wrong/wrong_1_551.py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.