Ask Question
8 April, 21:04

Write a Python function prime_generator that takes as argument positive integers s and e (where s

+5
Answers (1)
  1. 8 April, 21:21
    0
    def prime_generator (s, e):

    for number in range (s, e+1):

    if number > 1:

    for i in range (2, number):

    if (number % i) = = 0:

    break

    else:

    print (number)

    prime_generator (6,17)

    Explanation:

    I believe you want to ask the prime numbers between s and e.

    - Initialize a for loop that iterates from s to e

    - Check if the number is greater than 1. If it is, go inside another for loop that iterates from 2 to that number. If the module of that number to any number in range (from 2 to that number) is equal to 0, this means the number is not a prime number. If the module is not equal to zero, then it is a prime number. Print the number
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a Python function prime_generator that takes as argument positive integers s and e (where s ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers