-
-
Save fatosmorina/408959d9a7921b6aae56736ebec10657 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import heapq | |
scores = [51, 33, 64, 87, 91, 75, 15, 49, 33, 82] | |
print(heapq.nlargest(3, scores)) # [91, 87, 82] | |
print(heapq.nsmallest(5, scores)) # [15, 33, 33, 49, 51] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment