Created
September 14, 2017 02:37
-
-
Save dalejandroramirez/57b6102d1f3a526513c2e7318646d0be to your computer and use it in GitHub Desktop.
dada una matrix todo numero bajo un cero se elimina
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def matrixElementsSum(A): | |
sum=0 | |
j=0 | |
while j<len(A)-1: | |
j=j+1 | |
for i in range(len(A[j])): | |
if A[j-1][i]==0: | |
A[j][i]=0 | |
if A[j-1][i]!=0 and j<=len(A)-1 : | |
sum=sum+A[j][i] | |
for k in A[0]: | |
sum=sum+k | |
return(sum) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment