# Print Prime Number in Python

#Python program to display all the prime numbers within an interval
# change the values of lower and upper for a different result
lower = 900
upper = 1000
# uncomment the following lines to take input from the user
#lower = int(input("Enter lower range: "))
#upper = int(input("Enter upper range: "))
print("Prime numbers between",lower,"and",upper,"are:")
for num in range(lower,upper + 1):

# prime numbers are greater than 1
if num > 1:
for i in range(2,num):
if (num % i) == 0:
break
else:
print(num)

## Output:

Prime numbers between 900 and 1000 are:
907
911
919
929
937
941
947
953
967
971
977
983
991
997

#### 1 comment:

1. nice article for beginners.thank you.
javacodegeeks
welookups python

## Categories

Android (23) AngularJS (1) Books (10) C (75) C# (12) C++ (81) Course (1) Downloads (1) Engineering (13) flutter (1) FPL (17) Hadoop (1) HTML&CSS (38) IS (25) Java (89) Leet Code (4) Pandas (1) PHP (20) Projects (17) Python (319) R (69) Software (14) SQL (27)  