I want to know my error for this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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)))

11th Sep 2023, 3:17 PM
Joyanta Sarkar
Joyanta Sarkar - avatar
5 Answers
+ 1
What error do you get? What is the task? Link your code instead of pasting it into the description box.
11th Sep 2023, 3:39 PM
Lisa
Lisa - avatar
0
Help me to link you...
11th Sep 2023, 3:42 PM
Joyanta Sarkar
Joyanta Sarkar - avatar
0
Use the add code option to insert the code.
11th Sep 2023, 4:05 PM
Fabian Roy
Fabian Roy - avatar
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.
11th Sep 2023, 6:34 PM
sandra
sandra - avatar
0
I pasted your code into the playground and it ran fine. What's the problem?
12th Sep 2023, 11:39 AM
Rain
Rain - avatar