Hello colleagues, you could tell me why it appears in this code when I run it: TypeError: append() takes exactly one argument (2 given)
when I add the positions in list 3.
And another thing: whenever I take out cousins, programs work well, but whenever I'm going to take out cousins in a matrix, it tells me that 1 is a prime and this makes the program not work as it should be.
Here my code:
"""32. Leer una matriz 3x3 entera y determinar en qué posiciones están los menores primos por fila"""
try:
matriz=[]
fil=0
columna=0
for a in range(3):
fila=[]
for b in range(3):
numeros=int(input("Digite un numero entero: "))
fila.append(numeros)
matriz.append(fila) #almaceno los numeros digitados en matriz
lista2=[]
lista3=[]
for c in range(len(matriz)):
menor=matriz[c][0]
for d in range(len(matriz[c])):
primo=matriz[c][d]
cont=0
for e in range(1,primo+1):
if (primo%e)==0:
cont+=1
if cont==2:
primo_menor=primo #determino si el numero es primo
if primo_menor<=menor:
menor=primo_menor
fil=c
columna=d
lista2.append(primo_menor) # al numero menor primo de cada fila lo almaceno aquí
lista3.append(columna,fil) #y almaceno las posiciones(columa,fila) de los primos menores
print("La matriz es:",matriz)
print("los primos menores de cada fila son:",lista2)
print("Y estan en las posiciones",lista3)
except ValueError:
print("El valor digitado debe ser numerico")