diff options
| author | Simon Green <mail@simon.green> | 2025-09-14 22:54:18 +1000 |
|---|---|---|
| committer | Simon Green <mail@simon.green> | 2025-09-14 22:54:18 +1000 |
| commit | 045da04e63323acdfffc3d1a0cd92bf0853364b0 (patch) | |
| tree | 643f80cc8f66f05500e94db273ea9faf700636b8 /challenge-338/sgreen/python/ch-1.py | |
| parent | 12d9b7370121f12b601562856772ed3c03f7bb94 (diff) | |
| download | perlweeklychallenge-club-045da04e63323acdfffc3d1a0cd92bf0853364b0.tar.gz perlweeklychallenge-club-045da04e63323acdfffc3d1a0cd92bf0853364b0.tar.bz2 perlweeklychallenge-club-045da04e63323acdfffc3d1a0cd92bf0853364b0.zip | |
sgreen solutions to challenge 338
Diffstat (limited to 'challenge-338/sgreen/python/ch-1.py')
| -rwxr-xr-x | challenge-338/sgreen/python/ch-1.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/challenge-338/sgreen/python/ch-1.py b/challenge-338/sgreen/python/ch-1.py new file mode 100755 index 0000000000..f91a214ebe --- /dev/null +++ b/challenge-338/sgreen/python/ch-1.py @@ -0,0 +1,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() |
