id
stringlengths 35
39
| content
stringlengths 44
3.85k
| max_stars_repo_path
stringlengths 52
57
|
|---|---|---|
refactory_data_question_4_correct_4_373
|
def sort_age(lst):
a = []
for i in lst:
a.append(i[1])
sort = []
while a:
largest = a[0]
for element in a:
if element > largest:
largest = element
a.remove(largest)
sort.append(largest)
lst2 = []
counter = 0
for i in sort:
for j in lst:
if j[1] == i:
lst2.append(j)
counter += 1
return lst2
|
./refactory/data/question_4/code/correct/correct_4_373.py
|
refactory_data_question_4_correct_4_226
|
def sort_age(lst):
sort = []
while lst:
largest = lst[0]
for element in lst:
if element[1] > largest[1]:
largest = element
lst.remove(largest)
sort.append(largest)
return sort
|
./refactory/data/question_4/code/correct/correct_4_226.py
|
refactory_data_question_4_correct_4_079
|
def sort_age(lst):
result = []
while lst:
largest = lst[0]
for i in lst:
if i[1] > largest[1]:
largest = i
lst.remove(largest)
result.append(largest)
return result
pass
|
./refactory/data/question_4/code/correct/correct_4_079.py
|
refactory_data_question_4_correct_4_401
|
def sort_age(lst):
final = []
temp = 0
while lst:
biggest = lst[0][1]
for i in lst:
if i[1]>=biggest:
biggest = i[1]
temp = i
lst.remove(temp)
final.append(temp)
return final
|
./refactory/data/question_4/code/correct/correct_4_401.py
|
refactory_data_question_4_correct_4_015
|
def sort_age(lst):
result = []
while lst !=[]:
lowest = lst[0][1]
index = 0
for i in range(1,len(lst)):
if lst[i][1]<lowest:
index = i
lowest = lst[i][1]
result = [lst[index]] + result
lst.pop(index)
return result
|
./refactory/data/question_4/code/correct/correct_4_015.py
|
refactory_data_question_4_correct_4_282
|
def sort_age(lst):
sort_lst = []
while lst:
high = lst[0]
for i in lst:
if i[1] > high[1]:
high = i
lst.remove(high)
sort_lst.append(high)
return sort_lst
|
./refactory/data/question_4/code/correct/correct_4_282.py
|
refactory_data_question_4_correct_4_204
|
def sort_age(lst):
result = []
while lst:
largest = lst[0]
for i in lst:
if i[1] > largest[1]:
largest = i
lst.remove(largest)
result.append(largest)
return result
pass
|
./refactory/data/question_4/code/correct/correct_4_204.py
|
refactory_data_question_4_correct_4_069
|
def sort_age(lst):
newlst=[]
while lst:
oldest = lst[0][1] #first age
for person in lst:
if person[1]>oldest:
oldest=person[1]
for person in lst:
if person[1]==oldest:
newlst.append(person)
lst.remove(person)
return newlst
|
./refactory/data/question_4/code/correct/correct_4_069.py
|
refactory_data_question_4_correct_4_222
|
def sort_age(lst):
sort = True
while sort:
sort = False
for i in range(len(lst)-1):
if lst[i][1] < lst[i+1][1]:
sort = True
lst[i], lst[i+1] = lst[i+1], lst[i]
return lst
|
./refactory/data/question_4/code/correct/correct_4_222.py
|
refactory_data_question_4_correct_4_198
|
def sort_age(lst):
result = []
while lst:
largest = lst[0]
for x in lst:
if x[1] > largest[1]:
largest = x
lst.remove(largest)
result.append(largest)
return result
|
./refactory/data/question_4/code/correct/correct_4_198.py
|
refactory_data_question_4_correct_4_046
|
def sort_age(lst):
if len(lst) == 1:
return lst
else:
new_list = []
while lst:
minimum = lst[0]
for i in lst:
if i[1] < minimum[1]:
minimum = i
new_list.append(minimum)
lst.remove(minimum)
return new_list[::-1]
|
./refactory/data/question_4/code/correct/correct_4_046.py
|
refactory_data_question_4_correct_4_028
|
def sort_age(lst):
result=[]
while lst:
biggest=lst[0][1]
tuple_biggest=lst[0]
for i in lst:
if i[1]>biggest:
biggest=i[1]
tuple_biggest=i
lst.remove(tuple_biggest)
result.append(tuple_biggest)
return result
|
./refactory/data/question_4/code/correct/correct_4_028.py
|
refactory_data_question_4_correct_4_393
|
def sort_age(lst):
final = []
temp = 0
while lst:
biggest = lst[0][1]
for i in lst:
if i[1]>=biggest:
biggest = i[1]
temp = i
lst.remove(temp)
final.append(temp)
return final
|
./refactory/data/question_4/code/correct/correct_4_393.py
|
refactory_data_question_4_correct_4_020
|
def sort_age(lst):
for i in range(0,len(lst)):
this=lst[i]
j=0
while j<i:
if this[1]>lst[j][1]:
break
j+=1
del lst[i]
lst.insert(j,this)
return lst
|
./refactory/data/question_4/code/correct/correct_4_020.py
|
refactory_data_question_4_correct_4_122
|
def sort_age(lst):
order = []
while lst:
oldest = lst[0]
for person in lst:
if person[1] > oldest[1]:
oldest = person
lst.remove(oldest)
order.append(oldest)
return order
|
./refactory/data/question_4/code/correct/correct_4_122.py
|
refactory_data_question_4_correct_4_258
|
def sort_age(lst):
newlst=[]
lstages=[i[1] for i in lst]
while lst:
for i in lst:
if i[1] == max(lstages):
newlst+=[i]
lst.remove(i)
lstages.remove(i[1])
return newlst
|
./refactory/data/question_4/code/correct/correct_4_258.py
|
refactory_data_question_4_correct_4_158
|
def sort_age(lst):
ages=[]
for j in lst:
ages.append(j[1])
ages=sort(ages)
new_lst=[]
for age in ages:
for i in lst:
if age==i[1]:
new_lst.append(i)
return new_lst
def sort(lst):
age=[]
while lst:
largest=lst[0]
for elem in lst:
if elem > largest:
largest = elem
lst.remove(largest)
age.append(largest)
return age
|
./refactory/data/question_4/code/correct/correct_4_158.py
|
refactory_data_question_4_correct_4_155
|
def sort_age(lst):
sort1 = []
while lst:
largest = lst[0]
for i in lst:
if i[1] > largest[1]:
largest = i
lst.remove(largest)
sort1.append(largest)
return sort1
|
./refactory/data/question_4/code/correct/correct_4_155.py
|
refactory_data_question_4_correct_4_268
|
def sort_age(lst):
n = len(lst) - 1
while n > 0:
for i in range(n):
if lst[i][1] > lst[i + 1][1]:
lst[i],lst[i + 1] = lst[i + 1], lst[i]
n = n-1
lst.reverse()
return lst
|
./refactory/data/question_4/code/correct/correct_4_268.py
|
refactory_data_question_4_correct_4_190
|
def sort_age(lst):
a = lst
sort = []
while a: # a is not []
smallest = a[0][1]
b=a[0]
for element in a:
if element[1] > smallest:
smallest = element[1]
b=element
a.remove(b)
sort.append(b)
return sort
|
./refactory/data/question_4/code/correct/correct_4_190.py
|
refactory_data_question_4_correct_4_084
|
def sort_age(lst):
a = lst
sort = []
while a:
largest = a[0]
for item in a:
if item[1] >largest[1]:
largest = item
a.remove(largest)
sort.append(largest)
return(sort)# Fill in your code here
|
./refactory/data/question_4/code/correct/correct_4_084.py
|
refactory_data_question_4_correct_4_152
|
def sort_age(lst):
sort = []
while lst:
largest = lst[0]
for element in lst:
if element[1] > largest[1]:
largest = element
lst.remove(largest)
sort.append(largest)
return sort
|
./refactory/data/question_4/code/correct/correct_4_152.py
|
refactory_data_question_4_correct_4_403
|
def sort_age(lst):
lst_len=len(lst)-1
while lst_len>0:
for i in range(lst_len):
if lst[i][1]>lst[i+1][1]:
lst[i],lst[i+1]=lst[i+1],lst[i]
lst_len-=1
return lst[::-1]
|
./refactory/data/question_4/code/correct/correct_4_403.py
|
refactory_data_question_4_correct_4_197
|
def sort_age(lst):
sort = []
while lst:
oldest = lst[0]
for i in lst:
if i[1]>oldest[1]:
oldest = i
lst.remove(oldest)
sort.append(oldest)
return sort
|
./refactory/data/question_4/code/correct/correct_4_197.py
|
refactory_data_question_4_correct_4_245
|
def sort_age(lst):
for i, e in enumerate(lst):
mx = max(range(i,len(lst)), key= lambda x: lst[x][1])
lst[i], lst[mx] = lst[mx], e
return lst
|
./refactory/data/question_4/code/correct/correct_4_245.py
|
refactory_data_question_4_correct_4_082
|
def sort_age(lst):
if len(lst) == 1:
return lst
elif lst == []:
return []
else:
s = 0
for i in lst:
if i[1] > s:
s = i[1]
t = i
lst.remove(t)
return [t] + sort_age(lst)
|
./refactory/data/question_4/code/correct/correct_4_082.py
|
refactory_data_question_4_correct_4_371
|
def sort_age(a):
for i in range(len(a)):
for j in range(len(a)-1, i, -1):
if a[j][1] > a[j-1][1]:
a[j], a[j-1] = a[j-1], a[j]
return a
|
./refactory/data/question_4/code/correct/correct_4_371.py
|
refactory_data_question_4_correct_4_255
|
def func(lst, x):
index = len(lst)
for i in range(len(lst)):
if lst[i][1] < x:
continue
else:
index = i
break
return index
def sort_age(lst):
newlist = []
for i in range(len(lst)):
age = lst[i][1]
b = func(newlist, age)
newlist.insert(b, lst[i])
return list(reversed(newlist))
|
./refactory/data/question_4/code/correct/correct_4_255.py
|
refactory_data_question_4_correct_4_087
|
def sort_age(lst):
newlst = []
while lst:
current = lst[0]
for element in lst:
if element[1] > current[1]:
current = element
newlst += (current,)
lst.remove(current)
return newlst
|
./refactory/data/question_4/code/correct/correct_4_087.py
|
refactory_data_question_4_correct_4_036
|
def sort_age(lst):
new_lst = []
while lst:
max_age = lst[0]
for tpl in lst:
if tpl[1] > max_age[1]:
max_age = tpl
new_lst.append(max_age)
lst.remove(max_age)
return new_lst
|
./refactory/data/question_4/code/correct/correct_4_036.py
|
refactory_data_question_4_correct_4_110
|
def sort_age(lst):
new_lst = []
while lst:
max_num = lst[0]
for i in lst:
if i[1] > max_num[1]:
max_num = i
lst.remove(max_num)
new_lst.append(max_num)
return new_lst
|
./refactory/data/question_4/code/correct/correct_4_110.py
|
refactory_data_question_4_correct_4_077
|
def sort_age(lst):
# Fill in your code here
new_lst = [('A',10000),('B',0)]
for element in lst:
age = element[1]
for i in range(len(new_lst)):
if age > new_lst[i][1]:
new_lst.insert(i, element)
break
new_lst.remove(('A',10000))
new_lst.remove(('B',0))
return new_lst
|
./refactory/data/question_4/code/correct/correct_4_077.py
|
refactory_data_question_4_correct_4_039
|
def sort_age(lst):
result = []
while lst:
heights= map(lambda x:x[1],lst)
tall=max(heights)
person=list(filter(lambda x:x[1]==tall,lst))
result += person
lst.remove(person[0])
return result
|
./refactory/data/question_4/code/correct/correct_4_039.py
|
refactory_data_question_4_correct_4_400
|
def sort_age(lst):
sort = []
while lst:
largest = lst[0]
for i in lst:
if i[1] > largest[1]:
largest = i
lst.remove(largest)
sort.append(largest)
return sort
|
./refactory/data/question_4/code/correct/correct_4_400.py
|
refactory_data_question_4_correct_4_091
|
def sort_age(lst):
sorted_lst = []
while lst:
smallest = lst[0]
for i in lst:
if i[1] < smallest[1]:
smallest = i
lst.remove(smallest)
sorted_lst.append(smallest)
sorted_lst.reverse()
return sorted_lst
|
./refactory/data/question_4/code/correct/correct_4_091.py
|
refactory_data_question_4_correct_4_417
|
def sort_age(lst):
# Fill in your code here
newlst=[]
while lst:
maximum = lst[0]
for i in lst:
if i[1]>maximum[1]:
maximum = i
newlst.append(maximum)
lst.remove(maximum)
return newlst
|
./refactory/data/question_4/code/correct/correct_4_417.py
|
refactory_data_question_4_correct_4_243
|
def sort_age(lst):
sort = []
while lst:
largest = lst[0]
largestx = lst[0][1]
for element in lst:
if element[1] > largestx:
largestx = element[1]
largest = element
lst.remove(largest)
sort.append(largest)
return sort
|
./refactory/data/question_4/code/correct/correct_4_243.py
|
refactory_data_question_4_correct_4_129
|
def sort_age(lst):
sort=[]
while lst:
smallest = lst[0]
for i in lst:
if i[1] < smallest[1]:
smallest = i
sort.append(smallest)
lst.remove(smallest)
sort.reverse()
return sort
|
./refactory/data/question_4/code/correct/correct_4_129.py
|
refactory_data_question_4_correct_4_388
|
def sort_age(lst):
if len(lst)==1 or len(lst)==0:
return lst
else:
temp=lst[0][1]
count=0
for i in range(len(lst)):
if lst[i][1]>temp:
temp=lst[i][1]
count=i
result=[lst[count],]
pop=lst.pop(count)
return result+sort_age(lst)
# Fill in your code here
pass
|
./refactory/data/question_4/code/correct/correct_4_388.py
|
refactory_data_question_4_correct_4_323
|
def sort_age(lst):
newlst=[]
lstages=[i[1] for i in lst]
while lst:
for i in lst:
if i[1] == max(lstages):
newlst+=[i]
lst.remove(i)
lstages.remove(i[1])
return newlst
|
./refactory/data/question_4/code/correct/correct_4_323.py
|
refactory_data_question_4_correct_4_390
|
def sort_age(lst):
if len(lst)==1 or len(lst)==0:
return lst
else:
temp=lst[0][1]
count=0
for i in range(len(lst)):
if lst[i][1]>temp:
temp=lst[i][1]
count=i
result=[lst[count],]
pop=lst.pop(count)
return result+sort_age(lst)
# Fill in your code here
pass
|
./refactory/data/question_4/code/correct/correct_4_390.py
|
refactory_data_question_4_correct_4_032
|
def sort_age(lst):
sort_list = []
while lst: # a is not []
biggest = lst[0]
for element in lst:
if element[1] > biggest[1]:
biggest = element
lst.remove(biggest)
sort_list.append(biggest)
return sort_list
|
./refactory/data/question_4/code/correct/correct_4_032.py
|
refactory_data_question_4_correct_4_210
|
def sort_age(lst):
final = []
while lst:
largest = lst[0]
for i in lst:
if i[1] > largest[1]:
largest = i
lst.remove(largest)
final.append(largest)
return final
|
./refactory/data/question_4/code/correct/correct_4_210.py
|
refactory_data_question_4_correct_4_337
|
def sort_age(lst):
for i in range(len(lst)-1):
for a in range(i+1, len(lst)):
if lst[i][1] < lst[a][1]:
lst[i],lst[a]= lst[a],lst[i]
return lst
|
./refactory/data/question_4/code/correct/correct_4_337.py
|
refactory_data_question_4_wrong_4_059
|
def sort_age(lst):
a = []
b = []
n = len(lst)
for i in range(n):
age = lst[i][1]
a += [age]
a.sort()
a.reverse()
for j in range(n):
for k in range(n):
if a[j] == lst[k][1]:
b += [lst[k]]
else:
continue
return b
|
./refactory/data/question_4/code/fail/wrong_4_059.py
|
refactory_data_question_4_wrong_4_144
|
def sort_age(lst):
males = []
females = []
while len(lst) > 0:
if lst[0][0] == "M":
males = males + [lst[0],]
elif lst[0][0] == "F":
females = females + [lst[0],]
lst = lst[1:]
return merge(merge_sort(males), merge_sort(females))
def merge(left, right):
results = []
while left and right:
if left[0][0] < right[0][0]:
results.append(left.pop(0))
else:
results.append(right.pop(0))
results.extend(left)
results.extend(right)
return results
def merge_sort(lst):
if len(lst) < 2:
return lst
mid = len(lst) // 2
left = merge_sort(lst[:mid])
right = merge_sort(lst[mid:])
return merge(left, right)
|
./refactory/data/question_4/code/fail/wrong_4_144.py
|
refactory_data_question_4_wrong_4_099
|
def sort_age(lst):
for i in range(len(lst)-1):
while lst[i][1] < lst[i+1][1]:
temp = lst[i]
del lst[i]
lst += [temp]
return lst
|
./refactory/data/question_4/code/fail/wrong_4_099.py
|
refactory_data_question_4_wrong_4_153
|
def sort_age(lst):
return lst.sort(key = lambda x:x[1])
|
./refactory/data/question_4/code/fail/wrong_4_153.py
|
refactory_data_question_4_wrong_4_257
|
def sort_age(lst):
a = list(set(lst))
lst.clear()
lst.append(a)
return lst
|
./refactory/data/question_4/code/fail/wrong_4_257.py
|
refactory_data_question_4_wrong_4_183
|
def sort_age(lst):
lst.sort(key = lambda x: x[1], reverse = True)
print(lst)
|
./refactory/data/question_4/code/fail/wrong_4_183.py
|
refactory_data_question_4_wrong_4_334
|
def sort_age(lst):
for i in range(1,len(lst)):
while lst[i][1]<lst[i-1][1]:
lst.pop(i)
lst.insert(i-1,lst[i])# Fill in your code here
return lst.reverse()
|
./refactory/data/question_4/code/fail/wrong_4_334.py
|
refactory_data_question_4_wrong_4_101
|
def sort_age(lst):
for i in range(len(lst)-1):
while lst[i][1] > lst[i+1][1]:
temp = lst[i]
del lst[i]
lst += [temp]
lst.reverse()
return lst
|
./refactory/data/question_4/code/fail/wrong_4_101.py
|
refactory_data_question_4_wrong_4_207
|
def merge(one,two):
new_tup = []
while left and right:
if one[0][1] < two[0][1]:
new_tup.append(one.pop(0))
else:
new_tup.append(two.pop(0))
return new_tup
def sort_age(lst):
n = len(lst)
if n <2:
return lst
left = lst[:n/2]
right = lst[n/2:]
return merge(left,right)
|
./refactory/data/question_4/code/fail/wrong_4_207.py
|
refactory_data_question_4_wrong_4_343
|
def sort_age(lst):
return lst.sort(key=lambda x: x[1], reverse=True)
|
./refactory/data/question_4/code/fail/wrong_4_343.py
|
refactory_data_question_4_wrong_4_028
|
def sort_age(lst):
def for_age(lst):
for i in range(len(lst)):
if i == 0: continue
else:
while i > 0:
if lst[i][1] < lst[i-1][1]:
lst[i], lst[i-1] = lst[i-1], lst[i]
i -= 1
else: i = 0
for_age(lst).reverse
return lst
|
./refactory/data/question_4/code/fail/wrong_4_028.py
|
refactory_data_question_4_wrong_4_199
|
def sort_age(lst):
new_lst = []
for i in range(len(lst)):
if lst[i][1]> lst[i+1][1]:
new_lst.append(lst[i])
return lst
pass
|
./refactory/data/question_4/code/fail/wrong_4_199.py
|
refactory_data_question_4_wrong_4_182
|
def sort_age(lst):
lst.sort(key = lambda x: x[1], reverse = True)
print(lst)
|
./refactory/data/question_4/code/fail/wrong_4_182.py
|
refactory_data_question_4_wrong_4_164
|
def sort_age(lst):
lst.sort(key = lambda x: x[1])
|
./refactory/data/question_4/code/fail/wrong_4_164.py
|
refactory_data_question_4_wrong_4_098
|
def sort_age(lst):
for i in range(len(lst)-1):
while lst[i][1] > lst[i+1][1]:
temp = lst[i]
del lst[i]
lst += [temp]
return lst
|
./refactory/data/question_4/code/fail/wrong_4_098.py
|
refactory_data_question_4_wrong_4_208
|
def merge(one,two):
new_tup = []
while one and two:
if one[0][1] < two[0][1]:
new_tup.append(one.pop(0))
else:
new_tup.append(two.pop(0))
return new_tup
def sort_age(lst):
n = len(lst)
if n <2:
return lst
left = lst[:n/2]
right = lst[n/2:]
return merge(left,right)
|
./refactory/data/question_4/code/fail/wrong_4_208.py
|
refactory_data_question_4_wrong_4_232
|
def sort_age(lst):
compiled = []
result = []
for i in lst:
compiled = compiled + [i[1]]
compiled.sort()
compiled.reverse()
for i in compiled:
for j in lst:
if i == j[1]:
result = result + [j]
return result
|
./refactory/data/question_4/code/fail/wrong_4_232.py
|
refactory_data_question_4_wrong_4_145
|
def sort_age(lst):
males, females = [], []
for i in lst:
if i[0] == "M":
males = males + [lst[0],]
elif i[0] == "F":
females = females + [lst[0],]
lst = lst[1:]
return merge(merge_sort(males), merge_sort(females))
def merge(left, right):
results = []
while left and right:
if left[0] > right[0]:
results.append(left.pop(0))
else:
results.append(right.pop(0))
results.extend(left)
results.extend(right)
return results
def merge_sort(lst):
if len(lst) < 2:
return lst
mid = len(lst) // 2
left = merge_sort(lst[:mid])
right = merge_sort(lst[mid:])
return merge(left, right)
|
./refactory/data/question_4/code/fail/wrong_4_145.py
|
refactory_data_question_4_wrong_4_286
|
def sort_age(lst):
return lst.sort(key = lambda x: x[1], reverse = True)
|
./refactory/data/question_4/code/fail/wrong_4_286.py
|
refactory_data_question_4_wrong_4_300
|
def sort_age(lst):
lst.sort(key=lambda x:x[1])
lst.reverse()
print(lst)
|
./refactory/data/question_4/code/fail/wrong_4_300.py
|
refactory_data_question_4_wrong_4_131
|
def sort(lst):
for i in range(len(lst)-1):
if lst[i][1] > lst[i+1][1]:
temp = lst[i]
del lst[i]
lst += [temp]
else:
continue
return lst
def sort_age(lst):
oldlist = tuple(lst)
if tuple(sort(lst)) == oldlist:
return lst
else:
sort(lst)
return sort_age(lst)
|
./refactory/data/question_4/code/fail/wrong_4_131.py
|
refactory_data_question_4_wrong_4_301
|
def sort_age(lst):
lst.sort(key=lambda x:x[1])
lst.reverse()
print(lst)
|
./refactory/data/question_4/code/fail/wrong_4_301.py
|
refactory_data_question_4_wrong_4_263
|
def sort_age(lst):
# Fill in your code here
return lst.sort(key=lambda x: x[1])
|
./refactory/data/question_4/code/fail/wrong_4_263.py
|
refactory_data_question_4_wrong_4_303
|
def sort_age(lst):
lst.sort(key=lambda x:x[1])
lst.reverse()
print(lst)
|
./refactory/data/question_4/code/fail/wrong_4_303.py
|
refactory_data_question_4_wrong_4_197
|
def sort_age(lst):
new_lst = []
for i in range(len(lst)):
if lst[i][1]< lst[i+1][1]:
new_lst.append(lst[i])
lst.reverse()
return lst
pass
|
./refactory/data/question_4/code/fail/wrong_4_197.py
|
refactory_data_question_4_wrong_4_236
|
def sort_age(lst):
def age(i):
return i[1]
def position(seq, ele):
n = len(seq)
for i in range(n):
if seq[i] == ele:
return i
def largest_age(seq):
largest = age(seq[0])
largest_pos = 0
for i in seq:
if age(i) > largest:
largest = age(i)
largest_pos = position(seq,i)
return seq[largest_pos]
n = len(lst)
if n ==0:
return []
elif n ==1:
return lst
else:
return [largest_age(lst)]+[sort_age(lst[1:])]
# Fill in your code here
pass
|
./refactory/data/question_4/code/fail/wrong_4_236.py
|
refactory_data_question_4_wrong_4_333
|
def sort_age(lst):
for i in range(1,len(lst)):
while lst[i][1]<lst[i-1][1]:
lst.pop(lst[i])
lst.insert(lst[i],i-1)# Fill in your code here
return lst.reverse()
|
./refactory/data/question_4/code/fail/wrong_4_333.py
|
refactory_data_question_4_wrong_4_067
|
def sort_age(lst):
return lst.sort(key = lambda x: x[1])
|
./refactory/data/question_4/code/fail/wrong_4_067.py
|
refactory_data_question_4_wrong_4_350
|
def sort_age(lst):
# Fill in your code here
result=[]
for i in lst:
result+=[i[::-1],]
result.sort()
result.reverse()
ans=[]
for i in result:
ans+=[i[::-1],]
return ans
|
./refactory/data/question_4/code/fail/wrong_4_350.py
|
refactory_data_question_4_wrong_4_171
|
def sort_age(lst):
lst.sort(lambda x: x[1])
return lst
|
./refactory/data/question_4/code/fail/wrong_4_171.py
|
refactory_data_question_4_wrong_4_318
|
def sort_age(lst):
lst.sort(lambda x: x[1], reverse = True)
return lst
|
./refactory/data/question_4/code/fail/wrong_4_318.py
|
refactory_data_question_4_wrong_4_032
|
def sort_age(lst):
a=lst
sort=[]
while a:
smallest=a[0]
for element in a:
if element[1]<smallest[1]:
smallest=element
a.remove(smallest)
sort.append(smallest)
return sort
|
./refactory/data/question_4/code/fail/wrong_4_032.py
|
refactory_data_question_4_wrong_4_104
|
def sort_age(lst):
sort1 = []
while lst:
largest = lst[0][1]
if i[1] > largest:
largest = i[1]
lst.remove(i)
sort1.append(i)
return sort1
|
./refactory/data/question_4/code/fail/wrong_4_104.py
|
refactory_data_question_4_wrong_4_305
|
def sort_age(lst):
lst.sort(key=lambda x:x[1])
lst.reverse()
print(lst)
|
./refactory/data/question_4/code/fail/wrong_4_305.py
|
refactory_data_question_4_wrong_4_176
|
def sort_age(lst):
newlst = []
ages = []
for i in lst:
ages.append(i[1])
ages.sort()
for x in ages[::-1]:
for i in lst:
if i[1] == x:
newlst.append(i)
return newlst
|
./refactory/data/question_4/code/fail/wrong_4_176.py
|
refactory_data_question_4_wrong_4_096
|
def sort_age(lst):
lst.sort(key = lambda x: x[1])
return lst
|
./refactory/data/question_4/code/fail/wrong_4_096.py
|
refactory_data_question_4_wrong_4_100
|
def sort_age(lst):
for i in range(len(lst)-1):
while lst[i][1] > lst[i+1][1]:
temp = lst[i]
del lst[i]
lst += [temp]
return lst.reverse()
|
./refactory/data/question_4/code/fail/wrong_4_100.py
|
refactory_data_question_4_wrong_4_198
|
def sort_age(lst):
new_lst = [()]
for i in range(len(lst)):
if lst[i][1]< lst[i+1][1]:
new_lst.append(lst[i])
lst.reverse()
return lst
pass
|
./refactory/data/question_4/code/fail/wrong_4_198.py
|
refactory_data_question_4_wrong_4_143
|
def sort_age(lst):
males = []
females = []
for i in lst:
if lst[0][0] == "M":
males = males + [lst[0],]
elif lst[0][0] == "F":
females = females + [lst[0],]
return merge_sort(males) + merge_sort(females)
def merge(left, right):
results = []
while left and right:
if left[0][0] < right[0][0]:
results.append(left,pop(0))
else:
results.append(right.pop(0))
results.extend(left)
results.extend(right)
return results
def merge_sort(lst):
if len(lst) < 2:
return lst
mid = len(lst) // 2
left = merge_sort(lst[:mid])
right = merge_sort(lst[mid:])
return merge(left, right)
|
./refactory/data/question_4/code/fail/wrong_4_143.py
|
refactory_data_question_4_wrong_4_079
|
def sort_age(lst):
lst = lst.sort(key = lambda x: x[1], reverse=True)
return lst
|
./refactory/data/question_4/code/fail/wrong_4_079.py
|
refactory_data_question_4_wrong_4_037
|
def sort_age(lst):
lst.sort(key=lambda x: x[1],reverse=True)
print(lst)
|
./refactory/data/question_4/code/fail/wrong_4_037.py
|
refactory_data_question_4_wrong_4_224
|
def sort_age(lst):
a=[]
for i in lst:
if i==max(lst):
a.append(i)
continue
return a
|
./refactory/data/question_4/code/fail/wrong_4_224.py
|
refactory_data_question_4_wrong_4_337
|
def sort_age(lst):
new_lst=[lst[0],]
for x in lst[1:]:
if x[1] > new_lst[-1][1]:
new_lst += [x,]
else:
count=0
while count<len(new_lst):
if x[1] > new_lst[count][1]:
count+=1
continue
else:
new_lst = new_lst[0:count]+[x,]+new_lst[count:]
break
return new_lst[::-1]
|
./refactory/data/question_4/code/fail/wrong_4_337.py
|
refactory_data_question_4_wrong_4_042
|
def sort_age(lst):
return lst.sort(key = lambda x: x[1], reverse = True)
|
./refactory/data/question_4/code/fail/wrong_4_042.py
|
refactory_data_question_4_wrong_4_117
|
def sort_age(lst):
# Fill in your code here
lst.sort(key=lambda x : x[1], reverse=T)
|
./refactory/data/question_4/code/fail/wrong_4_117.py
|
refactory_data_question_4_wrong_4_235
|
def sort_age(lst):
return lst.sort(key=lambda x:x[1])
|
./refactory/data/question_4/code/fail/wrong_4_235.py
|
refactory_data_question_4_wrong_4_210
|
def sort_age(lst):
return lst.sort(key=lambda x: x[1], reverse=True)
|
./refactory/data/question_4/code/fail/wrong_4_210.py
|
refactory_data_question_4_wrong_4_160
|
def sort_age(lst):
return lst.sort(key = lambda x: x[1], reverse = True)
|
./refactory/data/question_4/code/fail/wrong_4_160.py
|
refactory_data_question_4_wrong_4_088
|
def sort_age(lst):
holder=[]
for x in lst:
if holder==[]:
holder=x
elif x[1]>holder[1]:
holder=x
return holder+sort_age(lst[1:])
|
./refactory/data/question_4/code/fail/wrong_4_088.py
|
refactory_data_question_4_reference
|
def sort_age(lst):
for i in range(0, len(lst)-1):
for j in range(i+1, len(lst)):
if lst[i][1] < lst[j][1]:
tmp = lst[i]
lst[i] = lst[j]
lst[j] = tmp
return lst
|
./refactory/data/question_4/code/reference/reference.py
|
refactory_data_question_4_wrong_4_194
|
def sort_age(lst):
biggest = lst[0][1]
for i in range(len(lst)):
if lst[0][1]<lst[i][1]:
biggest = lst[i][1]
continue
else:
biggest = lst[0][1]
return [(biggest),] + sort_age(lst[1:len(lst)])
pass
|
./refactory/data/question_4/code/wrong/wrong_4_194.py
|
refactory_data_question_4_wrong_4_260
|
def sort_age(lst):
sort = []
while lst:
smallest = lst[0]
for element in lst:
if element[1] < smallest[1]:
smallest = element
lst.remove(smallest)
sort.append(smallest)
return sort
|
./refactory/data/question_4/code/wrong/wrong_4_260.py
|
refactory_data_question_4_wrong_4_202
|
def sort_age(lst):
decoy = []
decoy2 = []
final = []
for i in lst:
decoy.append(i[1])
while decoy != []:
decoy2.append(min(decoy))
decoy.remove(min(decoy))
for i in decoy2:
for j in lst:
if i == j[1]:
final.append(j)
return final
|
./refactory/data/question_4/code/wrong/wrong_4_202.py
|
refactory_data_question_4_wrong_4_195
|
def sort_age(lst):
new = []
while lst:
smallest = lst[0][1]
for i in lst:
if i[1] < smallest:
smallest = i[1]
lst.remove(smallest)
new.append(smallest)
return new
|
./refactory/data/question_4/code/wrong/wrong_4_195.py
|
refactory_data_question_4_wrong_4_287
|
def sort_age(lst):
lst.sort(key = lambda x: x[1], reverse = True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_287.py
|
refactory_data_question_4_wrong_4_249
|
def sort_age(lst):
list1 = []
while lst:
biggest = lst[0][1]
b = lst[0]
for i in range(1,len(lst)):
if lst[i][1] > biggest:
biggest = lst[i][1]
b = (lst[i],)
lst.remove(b)
list1.append(b)
return list1
|
./refactory/data/question_4/code/wrong/wrong_4_249.py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.