+ 1
Python - Generators Challenge
Hi everyone. I would like to know if anyone has the correct answer to this challenge, because i have a solution which pass the first 3 tests, but not the last, and that one is hidden for not having a PRO account, and i dont know why it produces an error. This is my solution so far. Thanks def isPrime(x): if x < 2: return False elif x == 2: return True for n in range(2, x): if x % n ==0: return False return True def primeGenerator(a, b): #your code goes here for num in range(a, b+1): if isPrime(num): yield num f = int(input()) t = int(input()) print(list(primeGenerator(f, t)))
3 Respuestas