python program to print all prime numbers between an interval code example

Example 1: display prime numbers between two intervals in python

lowernum = int(input(“Enter your lower number”))
uppernum = int(input(“Enter your upper number”))
for num in range(lowernum,uppernum +1):
  if num> 1:
     for num in range(2,num):
        if (num % 1) == 0:
                    break
            else:
                print(num)

Example 2: python program to print prime numbers in an interval

lower = 800
upper = 900
print("Print the number's from ",lower," and ",upper,".")
for num in range(lower,upper + 1):
  if num > 1:
    for i in range(2, num):
      if (num % i) == 0:
        break
    else:
      print(num)