1
someone can help me find the mistake?
"""Returns a list of the three largest Elements input_list in order from largest to smallest. If input_list has Fewer than three Elements, Return input_list element Sorted largest to smallest/"""
# TODO: implement this function
def top_three(input_list):
list1 = [2,3,5,6,8,4,2,1]
input_list = sorted(list1, reverse=True)
return input_list[:3]
print (top_three(1))
Why is there this
[:2]
function call? You should not pass the full list as parameter?– Woss
was to return the first three numbers. I did a new function but don’t know where the error is: def top_three(input_list): list1 = [2,3,5,6,8,4,2,1] input_list = Sorted(list1, Reverse=True) Return input_list[:3] print (top_three(1))
– Márcio Feitosa