trabajo de clase

TRABAJO PARA ENTREGAR
# -*- coding: utf-8 -*-


import random as rd
import numpy as np
print("Matriz de n*n")
fc = int(input("Ingrese el numero de filas y columnas: "))
datos =np.zeros((fc,fc))

for b in range(fc):
    for a in range(fc):
        n = rd.randint(0,10)
        datos[a] [b] = n
bn=int(input("Ingrese un numero para buscarlo: "))
cuenta = 0

for a in range(fc):
    for b in range(fc):
        if bn == datos[a] [b]:
            cuenta = cuenta + 1

if cuenta > 0:
    print("El numero",bn,"esta",cuenta,"veces")
else:
    print("El numero",bn,"noexiste en la matriz")
print("\nEsta es la matriz que se genro : \n" , datos)

Share this

Related Posts

Previous
Next Post »