Python Day 11 : 2D Arrays | HackerRank 30 Days of Code Solutions


 Code:

#!/bin/python3

import math
import os
import random
import re
import sys



if __name__ == '__main__':
    arr = []



    for _ in range(6):
        tmp = [int(x) for x in str(input()).split(" ")]
        arr.append(tmp)

    maximum = -9 * 7

    for i in range(6):
        for j in range(6):
            if j + 2 < 6 and i + 2 < 6:
                result = arr[i][j] + arr[i][j + 1] + arr[i][j + 2] + 
arr[i + 1][j + 1] + arr[i + 2][j] + arr[i + 2][j + 1] + arr[i + 2][j + 2]
                if result > maximum:
                    maximum = result

    print(maximum)

AJ Blogs

Hello everyone, My name Arth and I like to write about what I learn. Follow My Website - https://sites.google.com/view/aj-blogs/home

Post a Comment

Previous Post Next Post
Best Programming Books

Facebook

AJ Facebook
Checkout Our Facebook Page
AJ Blogs
Checkout Our Instagram Page