How many times does it fit? help please - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: How many times does it fit? help please (/thread-4859.html) |
How many times does it fit? help please - skriff - Sep-11-2017 What im trying to do is to check how many times does an 1x1 slice fits in the entire array, i used slice to get array "fragments" but how to check how many times that fragment fits inside the entire array? the 1x1 fits 64 times, 2x2 16..... Tablero means board, by uxu i mean 1x1, dxd = 2x2.... import numpy as np tablero = np.zeros((8,8)) print(tablero) uxu = tablero[0:1,0:1] print(uxu) dxd = tablero [0:2,0:2] print (dxd) txt = tablero [0:3,0:3] print (txt) RE: How many times does it fit? help please - skriff - Sep-11-2017 Solved, left the code here if someone would like to see it Grande=Big Chica=Small Filas=Rows Columnas=Columns Entra=Fits Veces=Times maybe those few word translations will be useful :) import numpy as np nGrande = 8 matrizGrande = np.zeros((nGrande,nGrande)) for i in range(1,matrizGrande.shape[0]+1): matrizChica = np.zeros((i,i)) filasMatriz = matrizChica.shape[0] columnasMatriz = matrizChica.shape[1] entra = matrizGrande.shape[0]//filasMatriz * matrizGrande.shape[0]//columnasMatriz print("La Matriz de",str(i)+"x"+str(i)+" entra",entra, "veces en la matriz de",str(matrizGrande.shape[0])+"x"+str(matrizGrande.shape[0])) RE: How many times does it fit? help please - Sagar - Sep-12-2017 Number of times the small list S[row,col] fits in the Big list A[bRow,bCol] is equal to: (bRow * bCol)/(row * col) Hope you get the idea.. |