Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathan-kosgei/e449a38f91560983206d2d016f785c46 to your computer and use it in GitHub Desktop.
Save jonathan-kosgei/e449a38f91560983206d2d016f785c46 to your computer and use it in GitHub Desktop.
Find largest number in nested number list Python
def max_in_nested_number_list(numbers):
largest = 0
for item in numbers:
if isinstance(item, list):
numbers.append(max_in_nested_number_list(item))
else:
largest = item if item>largest else largest
return largest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment