Skip to content

Instantly share code, notes, and snippets.

@phalt
Last active December 18, 2015 07:39
Show Gist options
  • Save phalt/5747825 to your computer and use it in GitHub Desktop.
Save phalt/5747825 to your computer and use it in GitHub Desktop.
Simple minimum function that can be used recursively
def minimum(first, second):
# Returns the minimum
if first > second:
return sec
return first
#Test this
# print 5
print minimum(5, 10)
# print 11
print minimum(11, 20)
# Can be used recursively - prints 1
print minimum(minimum(3,1), 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment