30 Day code challenge-python
Day 11— 2D Arrays
Task
Calculate the hourglass sum for every hourglass in an array, then print the maximum hourglass sum
Input Format
There are lines 6 of input, where each line contains 6 space-separated integers that describe the 2D Array A.
Output Format
Print the maximum hourglass sum in A.
Explanation
Line 1–4: Creates a 2D Array of size 6 x 6
Line 16–17: Loops through the array from row 1–5 and column 1- 5
Line 18: Calls the hourglass_sum function where the function calculates the sum of hourglass and finally returns the maximum value. _sum = -63 because that’s the least hourglass_sum an array can hold.
Bonus Tip: Hourglass_sum can’t present in first row, last row, first column and last column
See you on Day 12