Check sibling questions

Write a Python program to accept two positive integers x and y from the user and then find and print all the prime numbers between x and y. 


Answer by student

x = int(input( "Enter the lower limit: " ))

y = int(input( "Enter the upper limit: " ))


print( "The prime numbers between" , x, "and" , y, "are:" )


for num in range(x, y + 1 ):

  if num > 1 :

    is_prime = True

    for i in range( 2 , num):

      if num % i == 0 :

        is_prime = False


    if is_prime:


Detailed answer by teachoo

The rest of the post is locked. Join Teachoo Black to see the full post.

Ask a doubt
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 13 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.