Skip to content

Instantly share code, notes, and snippets.

@dalejandroramirez
Created September 14, 2017 02:37
Show Gist options
  • Save dalejandroramirez/57b6102d1f3a526513c2e7318646d0be to your computer and use it in GitHub Desktop.
Save dalejandroramirez/57b6102d1f3a526513c2e7318646d0be to your computer and use it in GitHub Desktop.
dada una matrix todo numero bajo un cero se elimina
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