Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from numpy import array,shape
- def sala_mas_concurrida(cine):
- x,y=cine.shape
- max=-float("inf")
- cine_mas_concurrido=""
- for columna in range(y): #itera por columna
- acum=0 #acumula la suma de los true (que es de 1 c/u)
- for fila in range(x): #itera por final
- acum+=cine[fila][columna] #suma los true
- if acum>max:
- cine_mas_concurrido=columna
- max=acum
- return cine_mas_concurrido
- cine=array([[1,1,0,1,1],
- [1,1,1,1,1],
- [0,0,1,0,0],
- [1,0,1,1,0],
- [0,1,1,0,0],
- [1,0,1,0,1],
- [0,0,1,1,0],
- [0,1,1,0,1],
- [1,0,1,1,0],
- [0,1,1,0,1]])
- print sala_mas_concurrida(cine)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement