-3
def repita():
x = 2
while n % x != 0:
x += 1
repeat()
while n > 1:
n = n / x #aqui se encontra o primeiro problema, já que "n" não é reconhecido fora da função
x += 1
if n % x != 0:#mesmo problema de antes
repita() #aqui a função se repetiria aumentando o valor do "x"
My question is about how to use the Return so that "n" and "x" are recognized and I can work with them.
Extract? Divide one by the other? This question is not making much sense. Explain better what you are doing and what you want as a result for each input.
– Pablo Almeida
I edited the question, my doubt became clearer?
– Lucas Souza
What I don’t understand is what that function is. Why does it exist? What does "repeat" mean? It seems to be doing several things. Why not simply declare n and x outside?
– Pablo Almeida
My algorithm is still in its infancy, so I don’t know if it’s worth posting it in its entirety just to make sense of that stretch, so I used as an example this function that doesn’t make much sense thinking it would be easier to understand the doubt, but anyway I will edit and put the function of my code.
– Lucas Souza