id stringlengths 35 39 | content stringlengths 44 3.85k | max_stars_repo_path stringlengths 52 57 |
|---|---|---|
refactory_data_question_5_correct_5_049 | def top_k(lst, k):
product = []
while lst:
largest = lst[0]
for i in lst:
if i>largest:
largest = i
lst.remove(largest)
product.append(largest)
return product[:k]
| ./refactory/data/question_5/code/correct/correct_5_049.py |
refactory_data_question_5_correct_5_164 | def top_k(lst, k):
sorted = []
while lst:
biggest = lst[0]
for elem in lst:
if elem > biggest:
biggest = elem
lst.remove(biggest)
sorted.append(biggest)
return sorted[:k]
| ./refactory/data/question_5/code/correct/correct_5_164.py |
refactory_data_question_5_correct_5_233 | def top_k(lst, k):
count = 0
op = []
while count < k:
op += [max(lst)]
lst.remove(max(lst))
count += 1
return op
| ./refactory/data/question_5/code/correct/correct_5_233.py |
refactory_data_question_5_correct_5_246 | def top_k(lst, k):
sortedlst = []
while len(sortedlst) != k:
largest = lst[0]
for el in lst:
if el > largest:
largest = el
sortedlst.append(largest)
lst.remove(largest)
return sortedlst
| ./refactory/data/question_5/code/correct/correct_5_246.py |
refactory_data_question_5_correct_5_127 | def top_k(lst, k):
result = []
while lst:
biggest = lst[0]
for number in lst:
if number > biggest:
biggest = number
lst.remove(biggest)
result.append(biggest)
return result[:k]
| ./refactory/data/question_5/code/correct/correct_5_127.py |
refactory_data_question_5_correct_5_016 | def magus_sort(lst):
if len(lst) == 0:
return []
elif len(lst) == 1:
return lst
elif len(lst) == 2:
if lst[0] >= lst[1]:
return lst
else:
return [lst[1], lst[0]]
else:
if lst[0] >= lst[1]:
list1, list2 = [lst[0]], [lst[1]]
... | ./refactory/data/question_5/code/correct/correct_5_016.py |
refactory_data_question_5_correct_5_366 | def top_k(lst,k):
nlst = []
for x in range(k):
b = max(lst)
nlst.append(b)
lst.remove(b)
return nlst
| ./refactory/data/question_5/code/correct/correct_5_366.py |
refactory_data_question_5_correct_5_237 | def top_k(lst, k):
new_lst = []
while len(new_lst) < k:
new_lst.append(max(lst))
lst.remove(max(lst))
return new_lst
| ./refactory/data/question_5/code/correct/correct_5_237.py |
refactory_data_question_5_correct_5_230 | def top_k(lst, k):
new_lst = []
while lst:
big = lst[0]
for i in lst:
if i > big:
big = i
lst.remove(big)
new_lst.append(big)
return new_lst[:k]
| ./refactory/data/question_5/code/correct/correct_5_230.py |
refactory_data_question_5_correct_5_250 |
def top_k(lst, k):
x = []
for i in range(k):
a = 0
for ele in lst:
if ele >= a:
a = ele
lst.remove(a)
x.append(a)
return x
| ./refactory/data/question_5/code/correct/correct_5_250.py |
refactory_data_question_5_correct_5_294 | def top_k(lst, k):
values = []
while len(values) < k:
greatest = lst[0]
for item in lst:
if item > greatest:
greatest = item
lst.remove(greatest)
values.append(greatest)
return values
| ./refactory/data/question_5/code/correct/correct_5_294.py |
refactory_data_question_5_correct_5_343 | def top_k(lst, k):
# Fill in your code here
sort = []
while lst:
biggest = lst[0]
for element in lst:
if element > biggest:
biggest = element
lst.remove(biggest)
sort.append(biggest)
return sort[:k]
| ./refactory/data/question_5/code/correct/correct_5_343.py |
refactory_data_question_5_correct_5_299 | def top_k(lst, k):
sort = []
while lst:
oldest = lst[0]
for x in lst:
if x > oldest:
oldest = x
lst.remove(oldest)
sort.append(oldest)
return sort[0:k]
| ./refactory/data/question_5/code/correct/correct_5_299.py |
refactory_data_question_5_correct_5_333 | def top_k(lst,k):
def top(lst):
s = []
while lst:
smallest = lst[0]
for element in lst:
if element>smallest:
smallest = element
lst.remove(smallest)
s.append(smallest)
return s
s = top(lst)
return s[... | ./refactory/data/question_5/code/correct/correct_5_333.py |
refactory_data_question_5_correct_5_276 | def top_k(lst, k):
swap = True
while swap:
swap = False
for i in range(len(lst)-1):
if lst[i] < lst[i+1]:
lst[i], lst[i+1] = lst[i+1], lst[i]
swap = True
return lst[:k]
pass
| ./refactory/data/question_5/code/correct/correct_5_276.py |
refactory_data_question_5_correct_5_403 | def top_k(lst, k):
counter=0
new_lst=[]
while counter<k:
maxi=max(lst)
new_lst.append(maxi)
lst.remove(maxi)
counter+=1
return new_lst
| ./refactory/data/question_5/code/correct/correct_5_403.py |
refactory_data_question_5_correct_5_028 |
def top_k(lst, k):
sort = []
while lst:
biggest = lst[0]
for elem in lst:
if elem > biggest:
biggest = elem
lst.remove(biggest)
sort.append(biggest)
return sort[:k]
| ./refactory/data/question_5/code/correct/correct_5_028.py |
refactory_data_question_5_correct_5_003 | def top_k(lst, k):
res = []
for i in range(k):
res.append(max(lst))
lst.remove(max(lst))
return res
| ./refactory/data/question_5/code/correct/correct_5_003.py |
refactory_data_question_5_correct_5_098 | def top_k(lst, k):
# Fill in your code here
new = []
for i in range(k):
a = max(lst)
lst.remove(a)
new.append(a)
return new
| ./refactory/data/question_5/code/correct/correct_5_098.py |
refactory_data_question_5_correct_5_156 | def top_k(lst, k):
sorted_lst = []
while lst:
largest = lst[0]
for element in lst:
if element > largest:
largest = element
lst.remove(largest)
sorted_lst.append(largest)
return sorted_lst[:k]
pass
| ./refactory/data/question_5/code/correct/correct_5_156.py |
refactory_data_question_5_correct_5_193 | def top_k(lst, k):
answer = []
a = lst[0]
while lst:
for i in range(len(lst)):
answer.append(max(lst))
lst.remove(max(lst))
return answer[:k]
| ./refactory/data/question_5/code/correct/correct_5_193.py |
refactory_data_question_5_correct_5_191 | def get_largest(lst):
for i in range (len(lst)-1):
if lst[i]> lst[i+1]:
lst[i],lst[i+1] = lst[i+1],lst[i]
return lst[-1]
def top_k(lst, k):
result = []
for i in range (len(lst)):
if len(result) < k:
largest = get_largest(lst)
lst.remove(largest... | ./refactory/data/question_5/code/correct/correct_5_191.py |
refactory_data_question_5_correct_5_167 | def top_k(lst, k):
sort = []
while lst:
largest = lst[0]
for i in lst:
if i>largest:
largest = i
lst.remove(largest)
sort.append(largest)
return sort[:k]
| ./refactory/data/question_5/code/correct/correct_5_167.py |
refactory_data_question_5_correct_5_393 | def top_k(lst, k):
sort = []
while lst:
largest = lst[0]
for i in lst:
if i > largest:
largest = i
lst.remove(largest)
sort.append(largest)
return sort[:k]
| ./refactory/data/question_5/code/correct/correct_5_393.py |
refactory_data_question_5_correct_5_325 | def top_k(lst, k):
res = []
while len(res) != k:
elem = max(lst)
lst.remove(elem)
res.append(elem)
return res
| ./refactory/data/question_5/code/correct/correct_5_325.py |
refactory_data_question_5_correct_5_236 | def top_k(lst, k):
results = []
for i in range(k):
results.append(max(lst))
lst.remove(max(lst))
return results
| ./refactory/data/question_5/code/correct/correct_5_236.py |
refactory_data_question_5_correct_5_281 | def top_k(lst, k):
# Fill in your code here
def sort(lst):
sorted_list = []
while lst:
largest = lst[0]
for element in lst:
if largest < element:
largest = element
lst.remove(largest)
sorted_list.append(largest)
... | ./refactory/data/question_5/code/correct/correct_5_281.py |
refactory_data_question_5_correct_5_320 | def top_k(lst,k):
sort = []
while lst:
biggest = lst[0]
for element in lst:
if element > biggest:
biggest = element
lst.remove(biggest)
sort.append(biggest)
new_sort = []
for i in range (k):
new_sort += [sort[i]]
return new_sort
| ./refactory/data/question_5/code/correct/correct_5_320.py |
refactory_data_question_5_correct_5_231 | def top_k(lst, k):
lst2 = []
lst3 = []
while lst:
largest = lst[0]
for i in lst:
if i > largest:
largest = i
lst.remove(largest)
lst2.append(largest)
if len(lst2) <= k:
k = len(lst2)
for i2 in range(k):
lst3.append(lst2[i2])... | ./refactory/data/question_5/code/correct/correct_5_231.py |
refactory_data_question_5_correct_5_023 | def top_k(lst, k):
result=[]
for i in range(0,k):
max=lst[0]
for j in lst:
if j>max:
max=j
result.append(max)
lst.remove(max)
return result# Fill in your code here
pass
| ./refactory/data/question_5/code/correct/correct_5_023.py |
refactory_data_question_5_correct_5_220 | def top_k(lst, k):
new_lst = []
while lst:
big = lst[0]
for i in lst:
if i > big:
big = i
lst.remove(big)
new_lst.append(big)
return new_lst[:k]
| ./refactory/data/question_5/code/correct/correct_5_220.py |
refactory_data_question_5_correct_5_257 | def top_k(lst,k):
if len(lst) == 0:
return lst
largest = 0
newlist = []
for i in range(k):
for item in lst:
if item >= largest:
largest = item
lst.remove(largest)
newlist.append(largest)
if len(lst) == 0:
break
largest = lst[0]
return newlist
| ./refactory/data/question_5/code/correct/correct_5_257.py |
refactory_data_question_5_correct_5_268 | def top_k(lst, k):
new_lst = []
cut_lst = []
while lst:
biggest = lst[0]
for i in lst:
if i > biggest:
biggest = i
lst.remove(biggest)
new_lst.append(biggest)
for i in range(k):
cut_lst.append(new_lst[0])
new_lst.pop(0)
return cut_lst
| ./refactory/data/question_5/code/correct/correct_5_268.py |
refactory_data_question_5_correct_5_313 | def top_k(lst, k):
new, a = [], lst[0]
while lst:
for i in range(len(lst)):
new.append(max(lst))
lst.remove(max(lst))
return new[:k]
pass
| ./refactory/data/question_5/code/correct/correct_5_313.py |
refactory_data_question_5_correct_5_135 | def top_k(lst, k):
result = []
while lst:
biggest = lst[0]
for e in lst:
if e > biggest:
biggest = e
result.append(biggest)
lst.remove(biggest)
return result[:k]
| ./refactory/data/question_5/code/correct/correct_5_135.py |
refactory_data_question_5_correct_5_137 | def sort_by_value(lst):
final=[]
while lst:
largest=lst[0]
for i in lst:
if largest<i:
largest=i
lst.remove(largest)
final.append(largest)
return final
def top_k(lst,k):
return sort_by_value(lst)[:k]
| ./refactory/data/question_5/code/correct/correct_5_137.py |
refactory_data_question_5_correct_5_290 | def top_k(lst, k):
a=[]
while lst:
for i in lst:
a.append(max(lst))
lst.remove(max(lst))
return a[0:k]
| ./refactory/data/question_5/code/correct/correct_5_290.py |
refactory_data_question_5_correct_5_406 | def top_k(lst, k):
sort = []
while lst:
largest = lst[0]
for element in lst:
if element > largest:
largest = element
lst.remove(largest)
sort.append(largest)
return sort[0:k]
| ./refactory/data/question_5/code/correct/correct_5_406.py |
refactory_data_question_5_correct_5_369 | 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)
def merge(left, right):
results = []
while left and right:
if left[0] < right[0]:
results.append(le... | ./refactory/data/question_5/code/correct/correct_5_369.py |
refactory_data_question_5_correct_5_364 | def top_k(lst, k):
a=[]
sort =[]
while lst:
biggest = lst[0]
for i in lst:
if (i)> biggest:
biggest = i
lst.remove(biggest)
sort.append(biggest)
for i in range(k):
a = a + [sort[i],]
return a
pass
| ./refactory/data/question_5/code/correct/correct_5_364.py |
refactory_data_question_5_correct_5_013 | def top_k(lst, k):
new_lst = []
while lst:
largest = lst[0]
for numbers in lst:
if numbers > largest:
largest = numbers
new_lst.append(largest)
lst.remove(largest)
return new_lst[:k]
| ./refactory/data/question_5/code/correct/correct_5_013.py |
refactory_data_question_5_correct_5_380 | def top_k(lst, k):
l = []
if k > len(lst):
return False
elif k == 1:
return lst
else:
while len(l) < k:
a = max(lst)
lst.remove(a)
l.append(a)
return l
# Fill in your code here
pass
| ./refactory/data/question_5/code/correct/correct_5_380.py |
refactory_data_question_5_correct_5_182 | def top_k(lst, k):
max_lst =[]
i = 0
while i < k:
max_lst.append(max(lst))
lst.remove(max(lst))
i += 1
return max_lst
| ./refactory/data/question_5/code/correct/correct_5_182.py |
refactory_data_question_5_correct_5_075 | def top_k(lst, k):
sort = []
i = 0
while i < k:
smallest = lst[0]
for element in lst:
if element > smallest:
smallest = element
lst.remove(smallest)
sort.append(smallest)
i += 1
return sort
| ./refactory/data/question_5/code/correct/correct_5_075.py |
refactory_data_question_5_correct_5_072 | def top_k(lst,k):
newlst=[]
while lst:
highest=lst[0] #first number
for number in lst:
if number>highest:
highest=number
for number in lst:
if number==highest:
newlst.append(number)
lst.remove(number)
return newl... | ./refactory/data/question_5/code/correct/correct_5_072.py |
refactory_data_question_5_correct_5_007 | def top_k(lst, k):
if k == 0:
return []
if lst == []:
return lst
sort = []
while lst:
biggest = lst[0]
for element in lst:
if element > biggest:
biggest = element
lst.remove(biggest)
sort.append(biggest)
if len(sort) == ... | ./refactory/data/question_5/code/correct/correct_5_007.py |
refactory_data_question_5_correct_5_174 | def top_k(lst, k):
newlst = []
while len(newlst)<k:
maximum = lst[0]
for i in lst:
if i > maximum:
maximum = i
newlst.append(maximum)
lst.remove(maximum)
return newlst
| ./refactory/data/question_5/code/correct/correct_5_174.py |
refactory_data_question_5_correct_5_042 | def sort_age(lst):
new=[]
while lst !=[]:
big=lst[0]
for i in lst:
if i>big:
big=i
lst.remove(big)
new.append(big)
return new
def top_k(lst, k):
return sort_age(lst)[:k]
pass
| ./refactory/data/question_5/code/correct/correct_5_042.py |
refactory_data_question_5_correct_5_133 | def top_k(lst,k):
sort = []
while lst:
biggest = lst[0]
for element in lst:
if element > biggest:
biggest = element
lst.remove(biggest)
sort.append(biggest)
return sort[:k]
| ./refactory/data/question_5/code/correct/correct_5_133.py |
refactory_data_question_5_correct_5_261 | def top_k(lst, k):
values = []
while len(values) < k:
greatest = lst[0]
for item in lst:
if item > greatest:
greatest = item
lst.remove(greatest)
values.append(greatest)
return values
| ./refactory/data/question_5/code/correct/correct_5_261.py |
refactory_data_question_5_correct_5_070 | def top_k(lst, k):
s = []
for i in range(k):
t = 0
for r in lst:
if r >= t:
t = r
lst.remove(t)
s.append(t)
return s
| ./refactory/data/question_5/code/correct/correct_5_070.py |
refactory_data_question_5_correct_5_375 | def top_k(lst, k):
while lst:
maximum=[]
for a in range(len(lst)):
maximum.append(max(lst))
lst.remove(max(lst))
return maximum[0:k]
| ./refactory/data/question_5/code/correct/correct_5_375.py |
refactory_data_question_5_correct_5_222 | def top_k(lst, k):
def sort(lst):
sort = True
while sort:
sort = False
for i in range(len(lst)-1):
if lst[i] < lst[i+1]:
sort = True
lst[i], lst[i+1] = lst[i+1], lst[i]
return lst
lsts = sort(lst)
return ... | ./refactory/data/question_5/code/correct/correct_5_222.py |
refactory_data_question_5_correct_5_189 | def top_k(lst, k):
a = []
while k > 0:
a.append(max(lst))
lst.remove(max(lst))
k -= 1
return a
| ./refactory/data/question_5/code/correct/correct_5_189.py |
refactory_data_question_5_correct_5_160 | def top_k(lst, k):
# Fill in your code here
sort_lst=sort(lst)
return sort_lst[:k]
def sort(lst):
sort=[]
while lst:
largest=lst[0]
for elem in lst:
if elem > largest:
largest = elem
lst.remove(largest)
sort.append(largest)
return sort... | ./refactory/data/question_5/code/correct/correct_5_160.py |
refactory_data_question_5_correct_5_120 | def top_k(lst, k):
sorted_list = []
while lst:
l = lst[0]
for i in lst:
if i > l:
l = i
lst.remove(l)
sorted_list.append(l)
return sorted_list[:k]
| ./refactory/data/question_5/code/correct/correct_5_120.py |
refactory_data_question_5_correct_5_061 | def top_k(lst, k):
num, result = max(lst), []
while len(result) < k:
if num in lst:
result.append(num)
lst.remove(num)
elif num not in lst:
num -= 1
continue
return result
| ./refactory/data/question_5/code/correct/correct_5_061.py |
refactory_data_question_5_correct_5_096 | def top_k(lst, k):
res =[]
while lst:
largest = lst[0]
for element in lst:
if element > largest:
largest =element
lst.remove(largest)
res.append(largest)
return res[:k]
| ./refactory/data/question_5/code/correct/correct_5_096.py |
refactory_data_question_5_correct_5_130 | def top_k(lst, k):
new_lst = []
while len(new_lst) != k:
new_lst.append(max(lst))
lst.remove(max(lst))
return new_lst
| ./refactory/data/question_5/code/correct/correct_5_130.py |
refactory_data_question_5_correct_5_056 | def top_k(lst, k):
def merge_sort(lst):
if len(lst) <= 1:
return lst
else:
mid = len(lst) // 2
lst1 = merge_sort(lst[:mid])
lst2 = merge_sort(lst[mid:])
result = []
while lst1 and lst2:
if lst1[0] < ... | ./refactory/data/question_5/code/correct/correct_5_056.py |
refactory_data_question_5_correct_5_064 | def top_k(lst, k):
lst=sort_list(lst)
while len(lst)>k:
lst.pop(-1)
return lst
def sort_list(lst):
sort=[]
while lst:
largest=lst[0]
for i in lst:
if i>largest:
largest=i
lst.remove(largest) #1.indentation: under while loop
sort... | ./refactory/data/question_5/code/correct/correct_5_064.py |
refactory_data_question_5_correct_5_065 | def top_k(lst, k):
sorted_list = []
while lst:
l = lst[0]
for i in lst:
if i > l:
l = i
lst.remove(l)
sorted_list.append(l)
return sorted_list[:k]
| ./refactory/data/question_5/code/correct/correct_5_065.py |
refactory_data_question_5_correct_5_066 | def top_k(lst, k):
result = []
while len(result) < k:
result.append(lst.pop(lst.index(max(lst))))
return result
| ./refactory/data/question_5/code/correct/correct_5_066.py |
refactory_data_question_5_correct_5_092 | def top_k(lst, k):
s = []
for i in range(k):
t = 0
for r in lst:
if r >= t:
t = r
lst.remove(t)
s.append(t)
return s
| ./refactory/data/question_5/code/correct/correct_5_092.py |
refactory_data_question_5_correct_5_340 | def top_k(lst, k):
sort = []
while lst:
largest = lst[0]
for i in lst:
if i > largest:
largest = i
sort.append(largest)
lst.remove(largest)
top = sort[:k]
return top
| ./refactory/data/question_5/code/correct/correct_5_340.py |
refactory_data_question_5_correct_5_128 | def top_k(lst, k):
def mergesort(lst):
if len(lst) > 1:
mid = len(lst)//2
leftlst = lst[:mid]
rightlst = lst[mid:]
mergesort(leftlst)
mergesort(rightlst)
i = 0
j = 0
k = 0
while i < len(leftlst) and j... | ./refactory/data/question_5/code/correct/correct_5_128.py |
refactory_data_question_5_correct_5_404 | def top_k(lst,k): #k is the number of values in the lst
lst2 = []
for i in range(len(lst)):
a = max(lst)
lst2.append(a)
lst.remove(a)
return lst2[0:k]
| ./refactory/data/question_5/code/correct/correct_5_404.py |
refactory_data_question_5_correct_5_408 | def top_k(lst, k):
new_lst = []
if k == 0 or lst == []:
return []
else:
while k > 0:
new_lst.append(max(lst))
lst.remove(new_lst[-1])
k -= 1
return new_lst
| ./refactory/data/question_5/code/correct/correct_5_408.py |
refactory_data_question_5_correct_5_067 | def top_k(lst, k):
result = [lst[0]]
for i in lst[1:]:
if i > result[0]:
result.insert(0, i)
elif i <= result[-1]:
result.append(i)
else:
for j in range(1, len(result) - 1):
if i <= result[j] and i >= result[j+1]:
re... | ./refactory/data/question_5/code/correct/correct_5_067.py |
refactory_data_question_5_correct_5_296 | def top_k(lst, k):
if k == 0:
return []
if lst == []:
return lst
sort = []
while lst:
biggest = lst[0]
for element in lst:
if element > biggest:
biggest = element
lst.remove(biggest)
sort.append(biggest)
if len(sort) == ... | ./refactory/data/question_5/code/correct/correct_5_296.py |
refactory_data_question_5_correct_5_362 | def order (lst):
for i in range(len(lst)):
for j in range(i+1, len(lst)):
if lst[j] < lst[i]:
lst[i], lst[j] = lst[j], lst[i]
return lst
def top_k(lst, k):
result = []
a = order(lst)
counter = 0
while counter < k:
result.append(a.pop())
counter +=1
return result
| ./refactory/data/question_5/code/correct/correct_5_362.py |
refactory_data_question_5_correct_5_377 | def top_k(lst, k):
lst2 = []
while lst:
lst2.append(max(lst))
lst.remove(max(lst))
for x in lst:
if x in lst2:
lst2.append(x)
lst.remove(x)
return lst2[:k]
| ./refactory/data/question_5/code/correct/correct_5_377.py |
refactory_data_question_5_correct_5_084 | def top_k(lst,k):
a = []
while lst:
biggest = lst[0]
for element in lst:
if element > biggest:
biggest = element
lst.remove(biggest)
a.append(biggest)
return a[:k]
| ./refactory/data/question_5/code/correct/correct_5_084.py |
refactory_data_question_5_correct_5_303 | def top_k(lst, k):
# Fill in your code here
a = lst
sort = []
while a:
largest = a[0]
for item in a:
if item>largest:
largest = item
a.remove(largest)
sort.append(largest)
return(sort)[:k]
| ./refactory/data/question_5/code/correct/correct_5_303.py |
refactory_data_question_5_correct_5_358 | def top_k(lst, k):
sort = []
while lst:
largest = lst[0]
for element in lst:
if element > largest:
largest = element
lst.remove(largest)
sort.append(largest)
return sort[:k]
| ./refactory/data/question_5/code/correct/correct_5_358.py |
refactory_data_question_5_correct_5_089 | def top_k(lst, k):
# Fill in your code here
a = lst
sort = []
while a:
largest = a[0]
for item in a:
if item>largest:
largest = item
a.remove(largest)
sort.append(largest)
return(sort)[:k]
| ./refactory/data/question_5/code/correct/correct_5_089.py |
refactory_data_question_5_correct_5_274 | def top_k(lst, k):
k=len(lst) if k>len(lst) else k
l=[]
while len(l)!=k:
m=lst[0]
for i in lst:
if i>m:
m=i
l.append(m)
lst.remove(m)
return l
| ./refactory/data/question_5/code/correct/correct_5_274.py |
refactory_data_question_5_correct_5_077 | def top_k(lst, k):
def quick_sort(lst):
def cmp(a,b):
if a > b:
return True
else:
return False
if len(lst)==0:
return []
lst0=[]
lst1=[]
partition = lst[0]
for item in lst[1:]:... | ./refactory/data/question_5/code/correct/correct_5_077.py |
refactory_data_question_5_correct_5_100 | def sort_age(lst):
new=[]
while lst !=[]:
big=lst[0]
for i in lst:
if i>big:
big=i
lst.remove(big)
new.append(big)
return new
def top_k(lst, k):
return sort_age(lst)[:k]
pass
| ./refactory/data/question_5/code/correct/correct_5_100.py |
refactory_data_question_5_correct_5_330 | def top_k(lst, k):
new_list = []
while k > 0:
new_list.append(max(lst))
lst.remove(max(lst))
k = k-1
return new_list
| ./refactory/data/question_5/code/correct/correct_5_330.py |
refactory_data_question_5_correct_5_227 | def top_k(lst, k):
new_lst = []
while lst:
largest = lst[0]
for i in lst:
if i > largest:
largest = i
lst.remove(largest)
new_lst.append(largest)
return new_lst[0:k]
| ./refactory/data/question_5/code/correct/correct_5_227.py |
refactory_data_question_5_correct_5_264 | def top_k(lst, k):
result = []
for i in range(k):
result.append(max(lst))
lst.remove(max(lst))
return result
| ./refactory/data/question_5/code/correct/correct_5_264.py |
refactory_data_question_5_correct_5_198 | def top_k(lst, k):
l=lst.copy()
res=[]
while len(res)<k and l :
biggest=l[0]
for element in l:
if element>biggest:
biggest=element
l.remove(biggest)
res.append(biggest)
return res
| ./refactory/data/question_5/code/correct/correct_5_198.py |
refactory_data_question_5_correct_5_162 | def top_k(lst, k):
if k == 0 or lst == []:
return []
else:
sort, output = [], []
while lst:
largest = lst[0]
for i in lst:
if i > largest:
largest = i
lst.remove(largest)
sort.append(largest)
for ... | ./refactory/data/question_5/code/correct/correct_5_162.py |
refactory_data_question_5_correct_5_074 | def top_k(lst, k):
a = lst.copy()
b = lst.copy()
lst.clear()
for i in range(len(b)):
lst.append(max(a))
a.remove(max(a))
lst = lst[:k]
return lst# Fill in your code here
pass
| ./refactory/data/question_5/code/correct/correct_5_074.py |
refactory_data_question_5_correct_5_020 | def top_k(lst, k):
counter=0
new_lst=[]
while counter<k:
maxi=max(lst)
new_lst.append(maxi)
lst.remove(maxi)
counter+=1
return new_lst
| ./refactory/data/question_5/code/correct/correct_5_020.py |
refactory_data_question_5_correct_5_224 | def top_k(lst, k):
lst = sort_descending(lst)
return lst[:k]
def sort_descending(lst):
for i in range(len(lst)-1):
for j in range(i, len(lst)):
if lst[j] > lst[i]:
x = lst[i]
lst[i] = lst[j]
lst[j] = x
return lst
| ./refactory/data/question_5/code/correct/correct_5_224.py |
refactory_data_question_5_correct_5_285 | def top_k(lst,k):
sort_list = []
while lst:
biggest = lst[0]
for e in lst:
if biggest < e:
biggest = e
lst.remove(biggest)
sort_list.append(biggest)
return sort_list[:k]
| ./refactory/data/question_5/code/correct/correct_5_285.py |
refactory_data_question_5_correct_5_152 | def top_k(lst, k):
sort = []
while lst:
oldest = lst[0]
for x in lst:
if x > oldest:
oldest = x
lst.remove(oldest)
sort.append(oldest)
return sort[0:k]
| ./refactory/data/question_5/code/correct/correct_5_152.py |
refactory_data_question_5_correct_5_384 | def top_k(lst, k):
new_lst = []
while lst:
largest = lst[0]
for i in lst:
if i > largest:
largest = i
lst.remove(largest)
new_lst.append(largest)
return new_lst[0:k]
| ./refactory/data/question_5/code/correct/correct_5_384.py |
refactory_data_question_5_correct_5_059 | def top_k(lst, k):
while lst:
maximum=[]
for a in range(len(lst)):
maximum.append(max(lst))
lst.remove(max(lst))
return maximum[0:k]
| ./refactory/data/question_5/code/correct/correct_5_059.py |
refactory_data_question_5_correct_5_221 | def top_k(lst, k):
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)
def merge(left, right):
results = []
while left and right:
if left[0] > right[0]:
results.append(left.pop(0))
else... | ./refactory/data/question_5/code/correct/correct_5_221.py |
refactory_data_question_5_correct_5_134 | def top_k(lst, k):
lst=sort(lst)
lst=lst[:k]
return lst
def sort(lst):
for i in range(0,len(lst)-1):
for j in range(i+1,len(lst)):
if lst[i]<lst[j]:
lst[i],lst[j]=lst[j],lst[i]
return lst
| ./refactory/data/question_5/code/correct/correct_5_134.py |
refactory_data_question_5_correct_5_418 | def top_k(lst, k):
new = []
while lst:
largest = lst[0]
for a in lst:
if a > largest:
largest = a
lst.remove(largest)
new.append(largest)
return new[0:k]
| ./refactory/data/question_5/code/correct/correct_5_418.py |
refactory_data_question_5_correct_5_389 | def sort(lst):
if lst==[]:
return []
new_lst=[lst[0],]
for x in lst[1:]:
if x > new_lst[-1]:
new_lst += [x,]
else:
count=0
while count<len(new_lst):
if x > new_lst[count]:
count+=1
continue
... | ./refactory/data/question_5/code/correct/correct_5_389.py |
refactory_data_question_5_correct_5_278 | def top_k(lst, k):
for i in range(len(lst)-1):
for j in range(i+1, len(lst)):
if lst[i] < lst[j]:
lst[i], lst[j] = lst[j], lst[i]
result = []
for i in range(k):
result.append(lst[i])
return result
| ./refactory/data/question_5/code/correct/correct_5_278.py |
refactory_data_question_5_correct_5_004 | def top_k(lst, k):
result = []
for i in range(k):
result.append(max(lst))
lst.remove(max(lst))
return result
| ./refactory/data/question_5/code/correct/correct_5_004.py |
refactory_data_question_5_correct_5_107 | def top_k(lst, k):
arranged = []
while k > 0:
arranged.append(max(lst))
lst.remove(max(lst))
k = k-1
return arranged
pass
| ./refactory/data/question_5/code/correct/correct_5_107.py |
refactory_data_question_5_correct_5_372 | def top_k(lst, k):
def sort_largest(lst):
result = []
while lst and k:
largest = lst[0]
index = 0
for i in range(len(lst)):
if lst[i] > largest:
index = i
largest = lst[i]
result.append(largest)
... | ./refactory/data/question_5/code/correct/correct_5_372.py |
refactory_data_question_5_correct_5_328 | def top_k(lst, k):
a=[]
sort =[]
while lst:
biggest = lst[0]
for i in lst:
if (i)> biggest:
biggest = i
lst.remove(biggest)
sort.append(biggest)
for i in range(k):
a = a + [sort[i],]
return a
pass
| ./refactory/data/question_5/code/correct/correct_5_328.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.