Challenge: Prime Number Generator
Tehtävä
Swipe to start coding
Write a generator function primes_up_to(n) that yields all prime numbers less than or equal to n.
The function must:
- Yield numbers in ascending order, starting from the first prime number.
- Only yield numbers that are prime and less than or equal to
n. - Stop yielding values after reaching
n.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 2. Luku 3
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Awesome!
Completion rate improved to 6.67
Challenge: Prime Number Generator
Pyyhkäise näyttääksesi valikon
Tehtävä
Swipe to start coding
Write a generator function primes_up_to(n) that yields all prime numbers less than or equal to n.
The function must:
- Yield numbers in ascending order, starting from the first prime number.
- Only yield numbers that are prime and less than or equal to
n. - Stop yielding values after reaching
n.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 2. Luku 3
single