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:
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 break if is_prime: print(num) |
Detailed answer by teachoo
The rest of the post is locked. Join Teachoo Black to see the full post.