0

please any one who knows python help with this.....

Generators 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] The given code takes the two arguments as input and passes them to the generator function, outputting the result as a list.

17th Jan 2024, 3:39 PM
MUWANGUZI PETER
MUWANGUZI PETER - avatar
3 Antworten
+ 4
MUWANGUZI PETER , to which sololearn tutorial does your question refer? > in general: you should do a serious try by yourself first. put your code in playground, save it there, create a link to this code and post this link here.
17th Jan 2024, 4:03 PM
Lothar
Lothar - avatar
+ 3
instead of giving ready-made code, rather wait for the user to share their own attempt and help them to find their own solution. there is code given in task. you need to complete it with the knowledge about generators.
17th Jan 2024, 4:27 PM
Lisa
Lisa - avatar
+ 2
MUWANGUZI PETER , Yes, I remember that one, and many people ask about it here. The description is ambiguous, because "between" has multiple interpretations. "output the prime numbers in the given range (between the two arguments)." Imagine this instead. "output the prime numbers in the given range (including the first argument but not including the second argument)."
17th Jan 2024, 5:57 PM
Rain
Rain - avatar