Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. Quiz: Top Three
  2. Write a function, top_three, that takes a list as its argument, and returns a list of the three largest elements. For example, top_three([2,3,5,6,8,4,2,1]) == [8, 6, 5]
  3.  
  4. def top_three(input_list):
  5. input_list = sorted(input_list, reverse=True)
  6. return input_list[:3]
  7.  
  8. Your code displayed no output
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement