aboutsummaryrefslogtreecommitdiff
path: root/challenge-338/sgreen/python/ch-1.py
blob: f91a214ebe0398b972d7fa26f5da90ab500fb6b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3

import json
import sys


def highest_row(matrix: list[list[int]]) -> int:
    """Return the highest sum of any row in the matrix.

    Args:
        matrix: A list of lists of integers.

    Returns:
        The highest sum of any row in the matrix.
    """
    return max(sum(row) for row in matrix)


def main():
    # Convert input into a matrix
    matrix = json.loads(sys.argv[1])
    result = highest_row(matrix)
    print(result)


if __name__ == '__main__':
    main()