Skip to content

Instantly share code, notes, and snippets.

@brainyfarm
Created August 8, 2016 07:10
Show Gist options
  • Save brainyfarm/7ab6a8131627c1a0772e8b831bc6bdd9 to your computer and use it in GitHub Desktop.
Save brainyfarm/7ab6a8131627c1a0772e8b831bc6bdd9 to your computer and use it in GitHub Desktop.
FreeCodeCamp: Largest in an array of arrays [four] (Python)
"""
Return an array consisting of the largest number from each provided sub-array.
For simplicity, the provided array will contain exactly 4 sub-arrays.
"""
def largest_of_four(super_list):
# This is so easy thanks to list comprehension :)
return [max(element) for element in super_list]
print largest_of_four([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment