id
stringlengths 35
39
| content
stringlengths 44
3.85k
| max_stars_repo_path
stringlengths 52
57
|
|---|---|---|
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/wrong/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/wrong/wrong_4_144.py
|
refactory_data_question_4_wrong_4_269
|
def sort_age(lst):
lst.sort(key = lambda x: x[1], reverse = True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_269.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/wrong/wrong_4_099.py
|
refactory_data_question_4_wrong_4_128
|
def sort_age(lst):
people = []
while lst:
i = lst[0]
for a in lst:
if i[1] <= a[1] :
i = a
lst.remove(i)
final.append(i)
return final
|
./refactory/data/question_4/code/wrong/wrong_4_128.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/wrong/wrong_4_153.py
|
refactory_data_question_4_wrong_4_244
|
def sort_age(lst):
list1 = []
smallest = lst[0][1]
s = (lst[0],)
for i in range(1,len(lst)):
if lst[i][1] < smallest:
smallest = lst[i][1]
s = (lst[i],)
list1 += s
return list1
|
./refactory/data/question_4/code/wrong/wrong_4_244.py
|
refactory_data_question_4_wrong_4_295
|
def sort_age(lst):
sort=[]
while lst:
biggest=lst[0][1]
for i in range(len(lst)):
count=0
if lst[i][1]>=biggest:
biggest=lst[i][1]
else:
i+=1
count+=1
lst.remove(lst[i-count])
sort.append(lst[i-count])
return sort# Fill in your code here
|
./refactory/data/question_4/code/wrong/wrong_4_295.py
|
refactory_data_question_4_wrong_4_152
|
def sort_age(lst):
i=0
while i+1<len(lst):
if lst[i][1]<lst[i+1][1]:
lst.extend([lst[i]])
lst.pop(lst[i])
else:
i+=1
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_152.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/wrong/wrong_4_257.py
|
refactory_data_question_4_wrong_4_306
|
def sort_age(lst):
sort =[]
while lst:
smallest = lst[0]
for i in lst:
if i< smallest:
smallest = i
lst.remove(smallest)
sort.append(smallest)
pass
|
./refactory/data/question_4/code/wrong/wrong_4_306.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/wrong/wrong_4_183.py
|
refactory_data_question_4_wrong_4_125
|
def sort_age(lst):
lst1=[]
while lst:
smallest=lst[0]
for ele in lst:
if ele[1]<smallest[1]:
smallest=ele
lst.remove(smallest)
lst1.append(smallest)
return lst1
|
./refactory/data/question_4/code/wrong/wrong_4_125.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/wrong/wrong_4_334.py
|
refactory_data_question_4_wrong_4_231
|
def sort_age(lst):
a=[]
while lst:
biggest=lst[0]
for i in lst:
if i >= biggest:
biggest=i
lst.remove(biggest)
a.append(biggest)
return a
|
./refactory/data/question_4/code/wrong/wrong_4_231.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/wrong/wrong_4_101.py
|
refactory_data_question_4_wrong_4_137
|
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 = x
new_list.append(minimum)
lst.remove(minimum)
return new_list
|
./refactory/data/question_4/code/wrong/wrong_4_137.py
|
refactory_data_question_4_wrong_4_209
|
def sort_age(lst):
sort = []
while lst:
smallest = lst[0]
for element in a:
if element[1] < smallest[1]:
smallest = element
lst.remove(smallest)
sort.append(smallest)
pass
|
./refactory/data/question_4/code/wrong/wrong_4_209.py
|
refactory_data_question_4_wrong_4_323
|
def sort_age(lst):
new_lst = lst
newnew = [new_lst[0]]
for i in new_lst:
for j in range(len(newnew)):
if i[1]>newnew[j][1]:
newnew.insert(j+1,i)
elif i[1]<newnew[j][1]:
newnew.insert(j,i)
return newnew
return newnew
|
./refactory/data/question_4/code/wrong/wrong_4_323.py
|
refactory_data_question_4_wrong_4_109
|
def sort_age(lst):
sort = []
while lst:
biggest = lst[0]
for k in lst:
if k[1] > biggest[1]:
biggest = k
lst.remove(biggest)
sort.append(biggest)
|
./refactory/data/question_4/code/wrong/wrong_4_109.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/wrong/wrong_4_207.py
|
refactory_data_question_4_wrong_4_238
|
def sort_age(lst):
sort = []
while lst:
oldest = list[0]
for x in lst:
if x[1] > oldest[1]:
oldest = x
a.remove(oldest)
sort.append(oldest)
return sort
|
./refactory/data/question_4/code/wrong/wrong_4_238.py
|
refactory_data_question_4_wrong_4_127
|
def sort_age(lst):
sort = []
while lst:
oldest = lst[0]
for i in lst:
if i[1] > oldest[1]:
oldest = i
lst.remove(biggest)
sort.append(biggest)
return sort
# Fill in your code here
|
./refactory/data/question_4/code/wrong/wrong_4_127.py
|
refactory_data_question_4_wrong_4_166
|
def sort_age(lst):
sort = [] #empty list
while lst:
largest = lst[0] #let the first element be the smallest first
for i in lst:
if i[1] > largest[1]:
largest = i
lst.removal(largest)
sort.append(largest)
return sort
|
./refactory/data/question_4/code/wrong/wrong_4_166.py
|
refactory_data_question_4_wrong_4_041
|
def sort_age(lst):
lst.sort(key = lambda x: x[1], reverse = True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_041.py
|
refactory_data_question_4_wrong_4_193
|
def sort_age(lst):
lst.sort(key=lambda x: x[1], reverse=True)
return lst
pass
|
./refactory/data/question_4/code/wrong/wrong_4_193.py
|
refactory_data_question_4_wrong_4_130
|
def sort_age(lst):
people = []
while lst:
i = lst[0]
for a in lst:
if a[1] >= i[1] :
i = a
lst.remove(i)
people.append(i)
return final
|
./refactory/data/question_4/code/wrong/wrong_4_130.py
|
refactory_data_question_4_wrong_4_341
|
def sort_age(lst):
l = len(lst)
for i in range(0, l):
for j in range(0, l-i-1):
if (lst[j][1] > lst[j + 1][1]):
temp = lst[j]
lst[j]= lst[j + 1]
lst[j + 1]= temp
return list.reverse(lst)
|
./refactory/data/question_4/code/wrong/wrong_4_341.py
|
refactory_data_question_4_wrong_4_022
|
def sort_age(lst):
while lsst:
biggest = a[0]
for element in a:
if element > biggest:
smallest = element
a.remove(biggest)
sort.append(biggest)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_022.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/wrong/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/wrong/wrong_4_028.py
|
refactory_data_question_4_wrong_4_066
|
def sort_age(lst):
rslt=[]
while lst:
smallest=lst[0]
for element in a:
if element[1]>smallest[1]:
smallest=element
lst.remove(smallest)
rslt.append(smallest)
return rslt
|
./refactory/data/question_4/code/wrong/wrong_4_066.py
|
refactory_data_question_4_wrong_4_149
|
def sort_age(lst):
new = []
while lst:
small = lst[0][1]
name =lst[0][0]
for ele in lst:
if ele[1]<small:
small = ele[1]
name = ele[0]
new.append((name,small))
lst.remove((name,small))
return new
|
./refactory/data/question_4/code/wrong/wrong_4_149.py
|
refactory_data_question_4_wrong_4_256
|
def sort_age(lst):
newlst = []
while lst:
i = lst[0]
for element in lst:
if element[1] >= i[1]:
i = element
lst.remove(i)
final.append(i)
return newlst
|
./refactory/data/question_4/code/wrong/wrong_4_256.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/wrong/wrong_4_199.py
|
refactory_data_question_4_wrong_4_201
|
def sort_age(lst):
agelist = [lst[0],]
for i in lst:
if i[1] > agelist[0][1]:
agelist.insert(0, i)
elif i[1] < agelist[len(agelist)-1][1]:
agelist.insert(len(agelist), i)
else:
for x in range(0,len(agelist)):
if agelist[x][1]< i[1] < agelist[x+1][1]:
agelist.insert(x+1, i)
return agelist
|
./refactory/data/question_4/code/wrong/wrong_4_201.py
|
refactory_data_question_4_wrong_4_080
|
def sort_age(lst):
lst.sort(key=lambda x:x[1],reverse=True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_080.py
|
refactory_data_question_4_wrong_4_026
|
def sort_age(lst):
sort = []
while lst:
biggest = lst[0]
for element in lst:
if element > biggest:
biggest = element
lst.remove(biggest)
sort.append(biggest)
return sort
|
./refactory/data/question_4/code/wrong/wrong_4_026.py
|
refactory_data_question_4_wrong_4_031
|
def sort_age(lst):
if len(lst) == 0:
return []
elif len(lst) == 1:
return lst
else:
mid = len(lst) // 2
lst1 = sort_age(lst[:mid])
lst2 = sort_age(lst[mid:])
result = []
while lst1 and lst2:
if lst1[0][1] < lst2[0][1]:
result.append(lst2.pop())
else:
result.append(lst1.pop())
result.extend(lst1)
result.extend(lst2)
return result
|
./refactory/data/question_4/code/wrong/wrong_4_031.py
|
refactory_data_question_4_wrong_4_247
|
def sort_age(lst):
list1 = []
while lst:
biggest = lst[0][1]
b = lst[0]
for i in range(1,len(lst)-1):
if lst[i][1] > biggest:
biggest = lst[i][1]
s = (lst[i],)
lst.remove(biggest)
list1.append(biggest)
return list1
|
./refactory/data/question_4/code/wrong/wrong_4_247.py
|
refactory_data_question_4_wrong_4_289
|
def sort_age(lst):
new_list=[]
largest=0
while lst:
for i in lst:
if i[1]>largest:
largest = i[1]
new_list=new_list.append(i)
lst.remove(i)
return new_list
|
./refactory/data/question_4/code/wrong/wrong_4_289.py
|
refactory_data_question_4_wrong_4_086
|
def sort_age(lst):
lst.sort(key = lambda x:x[1], reverse = True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_086.py
|
refactory_data_question_4_wrong_4_118
|
def sort_age(lst):
sort=[]
while lst:
biggest=lst[0]
for element in lst:
if element[1] > biggest[1]:
biggest=element
lst.remove(biggest)
sort.append(biggest)
sort.append(biggest)
return sort
|
./refactory/data/question_4/code/wrong/wrong_4_118.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/wrong/wrong_4_182.py
|
refactory_data_question_4_wrong_4_313
|
def sort_age(lst):
lst.sort()
lst.sort(key=lambda x:x[1],reverse=True)
return lst
pass
|
./refactory/data/question_4/code/wrong/wrong_4_313.py
|
refactory_data_question_4_wrong_4_254
|
def sort_age(lst):
lst.sort(key = lambda x: x[1], reverse = True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_254.py
|
refactory_data_question_4_wrong_4_081
|
def sort_age(lst):
new_lst = []
while lst:
oldest = lst[0]
for i in range(len(lst)):
if lst[i][1] >= oldest[1]:
oldest = lst[i]
lst.remove(oldest)
new_lst.append(oldest)
print (new_lst)
|
./refactory/data/question_4/code/wrong/wrong_4_081.py
|
refactory_data_question_4_wrong_4_004
|
def sort_age(lst):
sort = []
while lst:
oldest = lst[0]
for person in lst:
if person[1] > oldest[1]:
person = oldest
a.remove(oldest)
sort.append(oldest)
print(lst)
|
./refactory/data/question_4/code/wrong/wrong_4_004.py
|
refactory_data_question_4_wrong_4_062
|
def sort_age(lst):
final=[]
while lst:
old=lst[0]
for i in lst:
if old[1]<i[1]:
old=i
final.append(old)
lst.remove(old)
return final
|
./refactory/data/question_4/code/wrong/wrong_4_062.py
|
refactory_data_question_4_wrong_4_138
|
def sort_age(lst):
while lst: # a is not []
smallest = lst[0]
for element in lst:
if element[1] < smallest[1]:
smallest = element
lst.remove(smallest)
sort.append(smallest)
|
./refactory/data/question_4/code/wrong/wrong_4_138.py
|
refactory_data_question_4_wrong_4_164
|
def sort_age(lst):
lst.sort(key = lambda x: x[1])
|
./refactory/data/question_4/code/wrong/wrong_4_164.py
|
refactory_data_question_4_wrong_4_035
|
def sort_age(lst):
lst.sort(key=lambda x: x[1], reverse=True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_035.py
|
refactory_data_question_4_wrong_4_008
|
def sort_age(lst):
for i in range(0,len(lst)):
this=lst[i]
for j in range(0,len(lst)):
if lst[j][1]<this[1]:
del lst[i]
lst=lst[0:j]+[this]+lst[j:]
return lst# Fill in your code here
pass
|
./refactory/data/question_4/code/wrong/wrong_4_008.py
|
refactory_data_question_4_wrong_4_250
|
def sort_age(lst):
swap = True
while swap:
swap = False
for tag in range(len(lst)-1):
if lst[tag][1] < lst[tag+1][1]:
lst[tag], lst[tag+1] = lst[tag+1], lst[tag]
swap = True
|
./refactory/data/question_4/code/wrong/wrong_4_250.py
|
refactory_data_question_4_wrong_4_281
|
def sort_age(lst):
for i in range(len(lst)-1):
for j in range(len(lst)-1-i):
if lst[j][1] > lst[j+1][1]:
lst[j+1][1], lst[j][1] = lst[j][1], lst[j+1][1]
else:
continue
return lst
pass
|
./refactory/data/question_4/code/wrong/wrong_4_281.py
|
refactory_data_question_4_wrong_4_218
|
def sort_age(lst):
new_lst = []
for i in range(len(lst)):
max_num = max(lst)
lst.remove(max_num)
new_lst.append(max_num)
return new_lst
t
|
./refactory/data/question_4/code/wrong/wrong_4_218.py
|
refactory_data_question_4_wrong_4_024
|
def sort_age(lst):
sort = []
while lst:
biggest = a[0]
for element in a:
if element > biggest:
smallest = element
lst.remove(biggest)
sort.append(biggest)
return sort
|
./refactory/data/question_4/code/wrong/wrong_4_024.py
|
refactory_data_question_4_wrong_4_121
|
def sort_age(lst):
first = lst[0]
firstnum = lst[0][1]
result = []
for x in lst[1:]:
if x[1] > firstnum:
result = (first,) + (x,)
else:
result = (x,) + (first,)
return result
pass
|
./refactory/data/question_4/code/wrong/wrong_4_121.py
|
refactory_data_question_4_wrong_4_148
|
def sort_age(lst):
i=0
while i+1<len(lst):
if i[1]<i+1[1]:
lst.pop(i)
lst.extend(i)
else:
i+=1
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_148.py
|
refactory_data_question_4_wrong_4_003
|
def sort_age(lst):
sort = []
while lst:
oldest = lst[0]
for person in lst:
if person[1] > oldest[1]:
person = oldest
a.remove(oldest)
sort.append(oldest)
print(sort)
|
./refactory/data/question_4/code/wrong/wrong_4_003.py
|
refactory_data_question_4_wrong_4_112
|
def sort_age(lst):
lst.sort(key=lambda x:x[1],reverse=True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_112.py
|
refactory_data_question_4_wrong_4_020
|
def sort_age(lst):
new_lst=[]
new_lst.append(lst[0])
for i in lst[1:]:
for j in range(len(new_lst)):
if i[1]>new_lst[j][1] and j==0:
new_lst.insert(0,i)
elif i[1]<new_lst[j][-1]:
new_lst.insert(-1,i)
elif i[1]>new_lst[j][1]:
new_lst.insert(j,i)
return new_lst
|
./refactory/data/question_4/code/wrong/wrong_4_020.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/wrong/wrong_4_098.py
|
refactory_data_question_4_wrong_4_330
|
def sort_age(lst):
sort = []
while lst:
biggest = lst[0]
for i in lst:
if i[1] > biggest[1]:
biggesr - k
lst.remove(biggest)
sort.append(biggest)
return sort
|
./refactory/data/question_4/code/wrong/wrong_4_330.py
|
refactory_data_question_4_wrong_4_014
|
def sort_age(lst):
lst.sort(key=lambda x: x[1], reverse=True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_014.py
|
refactory_data_question_4_wrong_4_298
|
def sort_age(lst):
a = []
while lst:
oldest = lst[0]
for i in lst:
if i[1] > oldest[1]:
oldest = i
lst.remove(oldest)
a.append(oldest)
pass
|
./refactory/data/question_4/code/wrong/wrong_4_298.py
|
refactory_data_question_4_wrong_4_161
|
def sort_age(lst):
lst.sort(key = lambda x: x[1], reverse = True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_161.py
|
refactory_data_question_4_wrong_4_017
|
def sort_age(lst):
lst.sort(key=lambda x: x[1],reverse = True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_017.py
|
refactory_data_question_4_wrong_4_234
|
def sort_age(lst):
sorted = []
while lst:
oldest = lst[0]
for element in lst:
if element[1] > oldest[1]:
oldest = element
lst.remove(oldest)
sorted.append(oldest)
return sorted
|
./refactory/data/question_4/code/wrong/wrong_4_234.py
|
refactory_data_question_4_wrong_4_155
|
def sort_age(lst):
new = []
while lst:
curr = lst[0][1]
for i in range(lst(old)):
if lst[i][1]<curr:
curr = lst[i][1]
counter = i
lst.remove(counter)
new.append(counter)
return new
|
./refactory/data/question_4/code/wrong/wrong_4_155.py
|
refactory_data_question_4_wrong_4_135
|
def sort_age(lst):
if lst == []:
return new
new = []
small = lst[0][1]
for i in range(1,len(lst)):
if lst[i][1]<small:
small = lst[i][1]
new.append(small)
lst.remove(small)
return sort_age(lst)
|
./refactory/data/question_4/code/wrong/wrong_4_135.py
|
refactory_data_question_4_wrong_4_167
|
def sort_age(lst):
sortt = [] #empty list
while lst:
largest = lst[0] #let the first element be the largest first
for i in lst:
if i[1] > largest[1]:
largest = i
lst.remove(largest)
sortt.append(largest)
return sort
|
./refactory/data/question_4/code/wrong/wrong_4_167.py
|
refactory_data_question_4_wrong_4_082
|
def sort_age(lst):
return lst.sort(key=lambda x:x[1],reverse=True)
|
./refactory/data/question_4/code/wrong/wrong_4_082.py
|
refactory_data_question_4_wrong_4_116
|
def sort_age(lst):
lst.sort(key=lambda x:x[1],reverse=True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_116.py
|
refactory_data_question_4_wrong_4_132
|
def sort_age(lst):
lst.sort(key= lambda x: x[1], reverse = True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_132.py
|
refactory_data_question_4_wrong_4_185
|
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)
print(a)
print(sort)# Fill in your code here
|
./refactory/data/question_4/code/wrong/wrong_4_185.py
|
refactory_data_question_4_wrong_4_223
|
def sort_age(lst):
a=[]
while lst:
for i in lst:
if i==max(lst):
a.append(i)
return a
|
./refactory/data/question_4/code/wrong/wrong_4_223.py
|
refactory_data_question_4_wrong_4_180
|
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)
print(a)
print(sort)# Fill in your code here
|
./refactory/data/question_4/code/wrong/wrong_4_180.py
|
refactory_data_question_4_wrong_4_114
|
def sort_age(lst):
# Fill in your code here
out = [lst[0],]
for ele in lst[1:]:
for indx in range(len(out)):
if out[indx][1] < ele[1]:
out.insert(indx, ele)
break
elif indx == len(out) - 1:
out.append(ele)
return out
|
./refactory/data/question_4/code/wrong/wrong_4_114.py
|
refactory_data_question_4_wrong_4_111
|
def sort_age(lst):
new_lst = []
while lst:
oldest = lst[0]
for i in range(len(lst)):
if lst[i][1] > oldest[1]:
oldest = lst[i]
lst.remove(oldest)
new_lst.append(oldest)
print(new_lst)
|
./refactory/data/question_4/code/wrong/wrong_4_111.py
|
refactory_data_question_4_wrong_4_220
|
def sort_age(lst):
male = []
female = []
for i in range(len(lst)):
if lst[i][0] == "M":
male.append(lst[i])
else:
female.append(lst[i])
male.sort()
female.sort()
combine = male[::-1] + female[::-1]
return combine
|
./refactory/data/question_4/code/wrong/wrong_4_220.py
|
refactory_data_question_4_wrong_4_268
|
def sort_age(lst):
# Fill in your code here
lst.sort(key=lambda x: x[1], reverse=True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_268.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/wrong/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/wrong/wrong_4_232.py
|
refactory_data_question_4_wrong_4_063
|
def sort_age(lst):
final=[]
while lst:
old=lst[0]
for i in lst:
if old[1]<i[1]:
old=i
lst.remove(old)
final.append(old)
return final
|
./refactory/data/question_4/code/wrong/wrong_4_063.py
|
refactory_data_question_4_wrong_4_280
|
def sort_age(lst):
lst.sort(key = lambda x: x[1], reverse = True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_280.py
|
refactory_data_question_4_wrong_4_237
|
def sort_age(lst):
lst.sort(key=lambda x:x[1])
lst.reverse()
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_237.py
|
refactory_data_question_4_wrong_4_217
|
def sort_age(lst):
lst.sort(key= lambda x: x[1], reverse = True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_217.py
|
refactory_data_question_4_wrong_4_052
|
def sort_age(lst):
newlst=[]
while lst:
oldest = lst[0][1] #first age
for person in lst:
if person[1]>oldest:
oldest=person[1]
newlst.append(person)
lst.remove(person)
newlst.append(lst[0])
lst.remove(lst[0])
return newlst
|
./refactory/data/question_4/code/wrong/wrong_4_052.py
|
refactory_data_question_4_wrong_4_134
|
def sort_age(lst):
if lst == []:
return new
new = []
small = lst[0][1]
for i in range(1,len(lst)):
if lst[i][1]<small:
small = lst[i][1]
new.append(small)
lst.remove(small)
sort_age(lst)
|
./refactory/data/question_4/code/wrong/wrong_4_134.py
|
refactory_data_question_4_wrong_4_270
|
def sort_age(lst):
if len(lst) < 2:
return lst
midpoint = len(lst) // 2
left = sort_age(lst[:midpoint])
right = sort_age(lst[midpoint:])
new_list = []
while left and right:
if left[0][1] < right[0][1]:
new_list.append(right.pop(0))
else:
new_list.append(left.pop(0))
new_list.extend(left)
new_list.extend(right)
return new_list
|
./refactory/data/question_4/code/wrong/wrong_4_270.py
|
refactory_data_question_4_wrong_4_076
|
def sort_age(lst):
lst.sort(key=lambda x:x[1],reverse=True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_076.py
|
refactory_data_question_4_wrong_4_329
|
def sort_age(lst):
sort = []
while lst:
biggest = lst[0]
for i in lst:
if i[1] > biggest[1]:
biggesr - k
lst.remove(biggest)
sort.append(biggest)
return sort
|
./refactory/data/question_4/code/wrong/wrong_4_329.py
|
refactory_data_question_4_wrong_4_163
|
def sort_age(lst):
lst = ()
for i in lst:
if lst[i][1]<lst[0][1]:
lst += lst[0]
else:
lst += lst[i]
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_163.py
|
refactory_data_question_4_wrong_4_071
|
def sort_age(lst):
while lst:
oldest = lst[0]
for i in lst[1:]:
if i[1] > oldest[1]:
oldest = i
lst.remove(oldest)
sort.append(oldest)
return sort
|
./refactory/data/question_4/code/wrong/wrong_4_071.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/wrong/wrong_4_145.py
|
refactory_data_question_4_wrong_4_170
|
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)
return sorted_lst.reverse
|
./refactory/data/question_4/code/wrong/wrong_4_170.py
|
refactory_data_question_4_wrong_4_011
|
def sort_age(lst):
result = []
while lst != []:
largest = lst[0][1]
for i in lst:
if i[1] > largest:
largest_tup = i
largest = i[1]
lst.remove(largest_tup)
result.append(largest_tup)
return result
|
./refactory/data/question_4/code/wrong/wrong_4_011.py
|
refactory_data_question_4_wrong_4_188
|
def sort_age(lst):
return lst.sort(key=lambda x: x[1], reverse=True)
|
./refactory/data/question_4/code/wrong/wrong_4_188.py
|
refactory_data_question_4_wrong_4_058
|
def sort_age(lst):
lst.sort(key = lambda x:x[1], reverse = True)
return lst
|
./refactory/data/question_4/code/wrong/wrong_4_058.py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.