-1
I have the following code and I need the result to be an integer type number, but it is returning a random value (number or None) with random type (int or nonetype)
from random import randint
def chave2():
final = ((3-1)*(7-1))
np = randint(2, final-1, 1) #Esta gerando tipos aleatórios para np
cont = 0
for x in range(1, np+1):
if np % x == 0:
cont += 1
if cont == 2 and final % np != 0:
return np
else:
chave2()
print(type(chave2()))
print(chave2())
ps:I have tried several Ides and different tmb versions, I am using version 3.7.4
randint
takes 2 argumentsrandint(start, end)
and not 3 !– SachaDee