Suma quadrat exterior X59930


Statement
 

pdf   zip

html

Dissenya una funció suma_qext(mat) que, donada una llista de llistes mat amb una matriu de mida m*nm,n>1, retorni la suma dels elements del requadre 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
Catalan
Translator
Original language
Spanish
Other languages
English Spanish
Official solutions
Python
User solutions
Python