Generation

generate functionThu, 25 May 2023

Hacer un programa que permita crear una matriz 3 x 3 y que la llene con números aleatorios. Luego de haber alimentado la matriz, reemplazar los valores de la primera fila y llenarla con números solicitados al usuario. Luego debe eliminar el dato de la matriz en la posición [2][2] y colocarle su nombre y al finalizar debe

def create_matrix(x,y): return [ [0] * x for i in range(y) ] matrix = create_matrix(3,3) def fill_matrix(m): for i in range(len(m)): for j in range(len(m)): m[i][j] = random.randrange(0,100) return m fill_matrix(matrix) def replace_first_row(m): for i in range(len(m)): m[0][i] = int(input('Ingrese numero: ')) return m replace_first_row(matrix) def remove_last_item(m): m[2][2] = input('Ingrese nombre: ') return m remove_last_item(matrix)

Questions about programming?Chat with your personal AI assistant