Add outer square X59930


Statement
 

pdf   zip

html

Design a function suma_qext(mat) which, given a list of lists mat with a matrix of size m*nm,n>1, returns the sum of the elements of the outer box.

Sample session
>>> mat = [[5,6,4,7,3],[9,3,7,4,2],[7,3,4,8,2],[2,3,6,2,2],[6,7,1,1,6]]
>>> suma_qext(mat)
70
>>> m = [[4, 4, 4], [4, 2, 9], [7, 2, 7], [1, 2, 3]]
>>> suma_qext(m)
45
>>> suma_qext([[1,1],[2,2]])
6
Information
Author
InfBesos
Language
English
Translator
Original language
Spanish
Other languages
Catalan Spanish
Official solutions
Python
User solutions
Python