Created
March 31, 2020 21:07
-
-
Save hsauers5/f2ecbc31fb23191f58565211e854e377 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
''' | |
An example of using a variable-length argument list as an argument to a function. | |
This will return the minimum of all arguments. | |
Example: variable_min(-1, 2, 4, 6) => -1 | |
''' | |
def variable_min(*args): | |
minimum = min(args[0], args[1]) | |
for i in range(2, len(args)): | |
minimum = min(minimum, args[i]) | |
return minimum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment