Skip to content

Instantly share code, notes, and snippets.

@zachelko
Created May 2, 2010 01:59
Show Gist options
  • Save zachelko/386828 to your computer and use it in GitHub Desktop.
Save zachelko/386828 to your computer and use it in GitHub Desktop.
def findLargestIterative(theList):
if len(theList) > 0:
largest = theList[0]
for item in theList:
if item > largest:
largest = item
return largest
else:
return None
def findLargestSort(theList):
listLength = len(theList)
if listLength > 0:
theList.sort()
return theList[listLength - 1]
else:
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment