Skip to content

Instantly share code, notes, and snippets.

@bharathmuddada
Created May 29, 2021 05:11
Show Gist options
  • Save bharathmuddada/bdccfcd5d70670e7e15cd69aafd75d40 to your computer and use it in GitHub Desktop.
Save bharathmuddada/bdccfcd5d70670e7e15cd69aafd75d40 to your computer and use it in GitHub Desktop.
Largest Element in list optimized
l=[10,5,28,6,35]
def getmax(l):
if not l:
return None
else:
res =l[0]
for i in range(1,len(l)):
if l[i] > res:
res =l[i]
return res
print(getmax(l))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment