1
Hello, I am making a list of exercises and I came across a question consisting of reading the elements of a list and determining how many are cousins.
I could only do the function to calculate the prime numbers, but I can’t do for the whole list, someone can help me?
def primos(x)
entrada = int(input())
contadora = 1
divisores = 0
while contadora <= entrada:
if entrada%contadora==0:
divisores += 1
contadora += 1
else:
contadora += 1
if divisores != 2:
print ('nao eh primo')
elif divisores == 2:
print ('eh primo')
I think a solution would be to read the list by parameter in a function 2 and call the function "primes" for each element of the function list 2 (list[i]), but I don’t know how to write this...