Add Them All X44784


Statement
 

pdf   zip   main.py

html

Write a function mat_sum(m) that receives a matrix of int’s m and returns the sum of all the integers in that matrix. The matrix of int’s is represented as a tuple of rows, each row being, in turn, a tuple of int’s.

Sample session
>>> mat_sum( ((8, 0, 2, -1), (4, 3, 2, 1), (10, 11, -11, -10)) ) * 2
38
Information
Author
José Luis Balcázar
Language
English
Official solutions
Python
User solutions
Python