Created
November 17, 2017 17:06
-
-
Save Manikkumar1988/9cf19b49cc4fd95659a8e97a35571309 to your computer and use it in GitHub Desktop.
GETTING MIN/MAX IN A SEQUENCE GREATER/LESS THAN SOME VALUE
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
def min_gt(seq, val): | |
return min([v for v in seq if v > val]) | |
def min_ge(seq, val): | |
return min([v for v in seq if v >= val]) | |
def max_lt(seq, val): | |
return max([v for v in seq if v < val]) | |
def max_le(seq, val): | |
return max([v for v in seq if v <= val]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment