Skip to content

Instantly share code, notes, and snippets.

@hsauers5
Created March 31, 2020 21:07
Show Gist options
  • Save hsauers5/f2ecbc31fb23191f58565211e854e377 to your computer and use it in GitHub Desktop.
Save hsauers5/f2ecbc31fb23191f58565211e854e377 to your computer and use it in GitHub Desktop.
'''
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