Returns the greatest product of four adjacent numbers (horizontally, vertically, or diagonally). >>> solution() 70600674
()
| 69 | |
| 70 | |
| 71 | def solution(): |
| 72 | """Returns the greatest product of four adjacent numbers (horizontally, |
| 73 | vertically, or diagonally). |
| 74 | |
| 75 | >>> solution() |
| 76 | 70600674 |
| 77 | """ |
| 78 | grid = [] |
| 79 | with open(os.path.dirname(__file__) + "/grid.txt") as file: |
| 80 | for line in file: |
| 81 | grid.append(line.strip("\n").split(" ")) |
| 82 | |
| 83 | grid = [[int(i) for i in grid[j]] for j in range(len(grid))] |
| 84 | |
| 85 | return largest_product(grid) |
| 86 | |
| 87 | |
| 88 | if __name__ == "__main__": |
no test coverage detected