← Back to Lists
Question 152
Largest In The Grid
Largest In The Grid
The grid matrix has three rows of three integers: declare it as [[3, 8, 1], [7, ?, 9], [4, 6, 5]] where the centre cell is read from input() as one integer with no prompt. Using a for loop over the rows and a second for loop over the values of each row, find the largest value and the row and column indexes where it first appears, counting rows and columns from 0 with counters you increase yourself. Start from the top-left value and replace it only when a strictly greater value is found, so the first of equal values wins. Print one line in the form Largest: <value> at row <r>, column <c>. Input: one integer. Do not use max().
Expected Output:
Largest: 9 at row 1, column 2= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Lists
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.