+ 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? https://code.sololearn.com/cs4t6SkGfzXi/?ref=app
3 Respostas
+ 2
https://code.sololearn.com/c1d9vOnP6xTe/?ref=app
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
+ 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]
+ 1
Thank you so much!