Python Developer - Generators | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Python Developer - Generators

I am working through the Python Developer course and am up to the section on generators. I attempted this code coach but I keep failing a hidden test case. What am I doing wrong?

12th Aug 2023, 2:28 AM
Lashana Jegatheswaran
3 Answers
+ 2 Difference: Changed line 13[LINE 15 IN FIXED CODE]: "b+1" to "b"... Your code is correct, but I think, maybe it does not want you to also include the number you input if it's also a prime. For example, let's say the last hidden case range is from 1 to 19, but it doesn't include the 19 in the list and your output includes it, making it failed
12th Aug 2023, 3:02 AM
Dragon RB
Dragon RB - avatar
+ 1
These are the instructions for the code coach: Finding prime numbers is a common coding interview task. The given code defines a function isPrime(x), which returns True if x is prime. You need to create a generator function primeGenerator(), that will take two numbers as arguments, and use the isPrime() function to output the prime numbers in the given range (between the two arguments). Sample Input 10 20 Sample Output [11, 13, 17, 19]
12th Aug 2023, 2:29 AM
Lashana Jegatheswaran
+ 1
Thank you so much!
12th Aug 2023, 3:59 AM
Lashana Jegatheswaran