Question: Please solve this question 5 on Python Question - 05 You are given a 2D array of size (m,n). Find the top 3 elements in
Please solve this question 5 on Python
Question - 05 You are given a 2D array of size (m,n). Find the top 3 elements in the array and their index. You've to return a dictionary. input= [[1,2,3], [4,0,1), [9,3,10]] output= { 'hi': { 'value': 10, 'index': [2,2] }, "h2': { 'value': 9, 'index': [2,0] }, "h3': { 'value': 4, 'index': [1,2] } } def ques_e5 (arr): return # run this cell to check your output. Don't modify this cell arr= [[1,2,24], [4,0,1], [9,3,10] [23,4,40] [25,109,9]] output= { 'hi': { 'value': 100, 'index': (4,1] }, "h2': { 'value': 40, 'index': (3,2] }, "h3': { 'value': 25, 'index': [4,0] }} ques_es(arr)--output # run this cell to check your output. Don't modify this cell arr= [[1,2,3], [4,0,1], [9,3,10]] output= { 'hi': { 'value': 10, 'index': [2,2] }, "h2': { 'value': 9, 'index': [2,0] }, "h3': { 'value': 4, 'index': [1,0] }} ques_e5 (arr)==output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
