Created
April 26, 2021 16:25
-
-
Save SamirPaulb/fe69aae059e4b0657e49b0f51cd73f26 to your computer and use it in GitHub Desktop.
Find out the Maximum Value in Nested List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python Program To Find out the Maximum Value in Nested List | |
list2 = [] | |
def get_max(list1): | |
for i in list1: | |
if type(i) == list: | |
get_max(i) | |
else: | |
list2.append(i) | |
return max(list2) | |
list1 = [1,2,23,[12,1,97,[245,42,[343,45,2,445666],35],3,5,2],53,[3,6],4,[3],4,] | |
print(get_max(list1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Find out the Maximum Value in Nested List