Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Asignatura:
Docente:
Integrantes:
1. ANALISIS.-
1.1. Entender el Problema.-
NxM
3x3
Columna=2
43 + 76 + 48 = 122
122/3= 55.666
Módulo Principal
2. DISEÑO.-
1.1. Pseudocódigo.-
Inicio
Matriz = [][]
Leer N
Leer M
Matriz1= LeerMatriz[Matriz, N, M]
MayorMatriz[Matriz1, N, M]
PromColumna[Matriz1, N, M]
I. CODIFICACIÓN
#función LeerMatriz
def LeerMatriz (Matriz, N, M):
for f in range(N):
for c in range(M):
# leer el valor
valor = int(input(f"Ingrese un valor para la posición {f, c}
:"))
# asignar el valor al arreglo
Matriz[f, c] = valor
return Matriz
#Procedimiento MayorMatriz
def MayorMatriz (Matriz, N, M):
MayorMatriz = 0
for f in range(N):
for c in range(M):
if Matriz[f, c] > MayorMatriz:
MayorMatriz = Matriz[f, c]
fila= f
colum= c
print(f"El elemento mayor de la matriz {N}x{M} esta en la posición
{fila, colum} y es:{MayorMatriz}")
#Procedimiento PromColumna
def PromColumna (Matriz, N, M):
Columna = int(input("Ingrese la columna que quiere su promedio:"))
SumaColum = 0
for f in range(N):
for c in range(M):
if Columna - 1 == c:
SumaColum = SumaColum + Matriz[f, c]
PromColum = SumaColum / M
print(f"El promedio de la columna {Columna} es:{PromColum}")
#Modulo principal
Matriz={}
N= int(input("Ingrese la cantidad de columnas:"))
M= int(input("Ingrese la cantidad de filas:"))
Matriz1=LeerMatriz(Matriz, N, M)
MayorMatriz(Matriz1, N, M)
PromColumna(Matriz1, N, M)
EJECUCIÓN
Columna=3
Módulo Principal
2. DISEÑO.-
1.1. Pseudocódigo.-
Inicio
Leer N
Leer M
MatrizA = [][]
MatrizB = [][]
SumaMatriz= []
MatrizA= LeerMatriz(MatrizA, N, M)
MatrizB= LeerMatriz(MatrizB, N, M)
SumaMatri= SumaArreglo(SumaMatriz, MatrizA, MatrizB, N, M)
MostrarSuma(SumaMatri, N)
CODIFICACIÓN
#función LeerMatriz
def LeerMatriz (Matriz, N, M):
for f in range(N):
for c in range(M):
# leer el valor
valor = int(input(f"Ingrese un valor para la posición {f, c} :"))
# asignar el valor al arreglo
Matriz[f,c] = valor
return Matriz
#Función SumaMatriz
def SumaArreglo(SumaMatriz, MatrizA, MatrizB, N, M):
Columna = int(input("Ingrese la columna que quiere su sumar:"))
for f in range(N):
for c in range(M):
if Columna-1==c:
Suma= MatrizA[f,c] + MatrizB[f,c]
SumaMatriz = SumaMatriz+[Suma]
return SumaMatriz
# Procedimiento MostrarSuma
def MostrarSuma(Suma, N):
for f in range(N):
print(Suma[f])
# Modulo principal
N = int(input("Ingrese la cantidad de columnas:"))
M = int(input("Ingrese la cantidad de filas:"))
MatrizA={}
MatrizB={}
SumaMatriz= []
#llamar a la función Leer elementos de la Matriz A
print("Ingrese los valores del primer matriz")
MatrizA=LeerMatriz(MatrizA, N, M)
#llamar a la función Leer elementos de la Matriz B
print("Ingrese los valores del segunda matriz")
MatrizB=LeerMatriz(MatrizB, N, M)
SumaMatri = SumaArreglo(SumaMatriz, MatrizA, MatrizB, N, M)
MostrarSuma(SumaMatri, N)
EJECUCIÓN
3. Elaborar un Algoritmo que utilizando modularidad halle la transpuesta de una matriz NxM
1. ANALISIS.-
1.1. Entender el Problema.-
Datos Resultado
Matriz1
12 [0, 0] 13 [0, 1] 15 [0, 2] 12[0, 0] 35 [0, 1] 25 [0, 2]
35 [1, 0] 55 [1, 1] 34 [1, 2] 13 [1, 0] 55 [1, 1] 10 [1, 2]
Módulo Principal
2. DISEÑO.-
1.1. Pseudocódigo.-
Inicio
Leer N
Leer M
Matriz = [][]
Matriz1= LeerMatriz(Matriz, N, M)
MostrarMatriz(Matriz1, N, M)
MatrizTrans(Matriz1, N, M)
CODIFICACIÓN
#función LeerMatriz
def LeerMatriz (Matriz, N, M):
for f in range(N):
for c in range(M):
# leer el valor
valor = int(input(f"Ingrese un valor para la posición {f, c}
:"))
# asignar el valor al arreglo
Matriz[f, c] = valor
return Matriz
#Procedimiento MostrarMatriz
def MostrarMatriz(Matriz, N, M):
for f in range(N):
for c in range(M):
print(f"{Matriz[f, c]}\t", end=" ")
print()
# Procedimiento MatrizTrans
def MatrizTrans(Matriz, N, M):
for c in range(M):
for f in range(N):
print(f"{Matriz[f, c]}\t", end=" ")
print()
# Modulo principal
N = int(input("Ingrese la cantidad de columnas:"))
M = int(input("Ingrese la cantidad de filas:"))
Matriz={}
Matriz1=LeerMatriz(Matriz, N, M)
print(f"Esta matriz {N}x{M}")
MostrarMatriz(Matriz1, N, M)
print(f"Su transpuesta es")
MatrizTrans(Matriz1, N, M)
EJECUCIÓN