Suma cuadrado exterior X59930


Statement
 

pdf   zip

html

Diseña una función suma_qext(mat) que, dada una lista de listas mat con una matriz de tamaño m*nm,n>1, devuelva la suma de los elementos del recuadro exterior.

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
Spanish
Other languages
Catalan English
Official solutions
Python
User solutions
Python