Reputation: 167
list1=[2,8,64,16,32,4]
import heapq
heapq.nlargest(2, list1)
This is the progress I have made so far. I am (extremely) new to python as you can tell.
Upvotes: 1
Views: 145
Reputation: 1167
heapq.nlargest returns a list. SO you need the last element of this list.
heapq.nlargest(2, list1)[-1] --> Gives you the answer.
Upvotes: 1