Skip to content

Instantly share code, notes, and snippets.

@nara-l
Last active May 22, 2018 18:49
Show Gist options
  • Save nara-l/770b1e12efbb207b2d62001361d3ffe5 to your computer and use it in GitHub Desktop.
Save nara-l/770b1e12efbb207b2d62001361d3ffe5 to your computer and use it in GitHub Desktop.
Finding the largest number in a list without usiing for loop python
def find_largest_num(Li):
if len(Li) ==1:
return Li[0]
x1 = Li[0]
x2 = find_largest_num(Li[1:])
if x1 > x2:
return x1
else:
return x2
'''Usage'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment