Problem 3: Output the first n prime numbers Write a Python function that outputs the first n prime numbers: 'def prime_numbers(n): return ' Here is the example output:
prime_numbers(5) 2 3 5 7 11 prime_numbers(7) 2 3 5 7 11 13 17
How do I solve this problem, the constrain is I can only use the while loop and if else condition. I cant use any inbuilt function like is_prime or any other loops.
thanks
Aucun commentaire:
Enregistrer un commentaire