Question: Write a program that reads in a square grid of numbers and find the largest n digit number that occurs left-to-right. Write a program that

Write a program that reads in a square grid of numbers and find the largest n digit number that occurs left-to-right.
Write a program that reads in a square grid of numbers and
find the largest n digit number that occurs left-to-right. Write a program
that reads in a square grid of numbers and find the largest

Write a program that reads in a square grid of numbers and find the largest nin digit number that occurs laft-to-right Load Grid Function The Ioad_.gridi) function takes a filename, reads the contents of the file and returns the square gid as a list of lists. f tlenase = "orid_5 by_5. txt" grtd = load_grtd(ftlenane ) 8. returns {[8,3,5,0,9],[8,4,4,5,1],[9,1, 2,3,2],[2,7,5,6,7],[7,7,1,3,3]] Print Grid Function There is a print. grida() function that will take a list of tlats Pthenane - "orta_5,by-5, txt" prtat_grtdtgrtd) print(nax_nun_in_rows(grid, 3)) \& prints 912 print(aax_num_adv(grtd, 3)) \# prints 971 help you visualise the grid. Max Number in Rows Function The max_num_in_rows() function takes in a square grid of numbers as a list of lists and the number of digits n to search for. It should find the maximum n-digit number. Here is an example for the following grid. 83689 84451 91232 27567 77133 The function should work as follows: \# grid stored in grid_5_by_5.txt grid =[[8,3,6,8,9],[8,4,4,5,1],[9,1,2, 3,2],[2,7,5,6,7],[7,7,1,3,3]] print(max_num_in_rows(grid, 2)) \# prints 91 print(max_num_in_rows(grid, 3)) \#prints 912 print(max_num_in_rows(grid, 4)) \# prints 9123 Advanced The max_num_adv() function is similar to the max_num_in_rows() function but should find the largest n-digit number that occurs either: - left-to-right - top-to-bottom - diagonally top-left-to-bottom-right - diagonally bottom-left-to-top-right For the 55 grid example, 83689 84451 91232 27567 77133 the function should work as follows: \# grid stored in grid_5_by_5, txt grid=[[8,3,6,8,9],[8,4,4,5,1],[9,1,2, 3,2],[2,7,5,6,7],[7,7,1,3,3]] print(max_num_adv(grid, 2)) \# prints 97 print(max_num_adv(grtd, 3)) * prints 971 print(max_num_adv(grid, 4)) \# prints 9127

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!