擅长:python、mysql、java
<p>你的压痕不对。返回语句在while循环中。它应该在它之外,这意味着您也需要在循环之外定义新的\u列表。请尝试以下操作:</p>
<pre><code>def divide_digits(a):
"""
This is where the function's Document string (docstring) goes.
"""
# make a shallow copy of the int_list and assign it to variable lst_copy
lst_copy = a[:]
# sort lst.copy
lst_copy.sort()
new_list = []
# as long as the lst_copy is not empty:
while lst_copy:
# get/pop the element from the beginning and at the end of the new_list
largest_num = lst_copy.pop()
smallest_num = lst_copy.pop(0)
# perform the division of two these elements
result = largest_num / smallest_num
# round down the result to the nearest integer
# append the result of the division operation to the new list
new_list.append(round(result))
# return the new_list
return new_list
</code></pre>