Answer to Question #208522 in Electrical Engineering for mona

Question #208522

Write python program To display the sum of largest and smallest value of a two-dimension array.


1
Expert's answer
2021-06-21T05:47:29-0400
numbers2D = [[11, 12, 5, 2], [15,18 ,6,10], [10, 8, 12, 5], [12,15,8,6]]
for row in numbers2D:
    for column in row:
        print(column,end = "\t")
    print()
largestValue=max(max(x) for x in numbers2D)
smallestValue=min(min(x) for x in numbers2D)
sumLargestSmallest=largestValue+smallestValue
print(f"\nThe largest value: {largestValue}")
print(f"The smallest value: {smallestValue}")
print(f"The sum of largest and smallest value of a two-dimension array: {sumLargestSmallest}")




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS