+ 3
I want to know my error for this code
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(f, t): #your code goes here if f<2: f=2 for num in range(f, t+1): if isPrime(num): yield (num) f = int(input()) t = int(input()) print(list(primeGenerator(f, t)))
5 Answers
+ 1
What error do you get?
What is the task?
Link your code instead of pasting it into the description box.
0
Help me to link you...
0
Use the add code option to insert the code.
0
Joyanta Sarkar ,
There are 2 small things to rework:
> In the prime generator function: These 2 lines are not required and can be deleted:
if f<2:
f=2
> In the prime generator function: In the range() function, the arguments should be: ..(f, t). The decription of the task sounds as if the end number should not be included.
0
I pasted your code into the playground and it ran fine. What's the problem?