program to print all Prime numbers in an Interval

def prime(x, y):

prime_list = []

for i in range(x, y):

if i == 0 or i == 1:



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

if i % j == 0:




return prime_list

starting_range = 2

ending_range = 7

lst = prime(starting_range, ending_range)

if len(lst) == 0:

print("There are no prime numbers in this range")


print("The prime numbers in this range are: ", lst)

1 comment:

Jessica morris said...

Nice write-up! To support the demand for Python app development, I Would like to share that Python has been in demand for web development, system administration, and software development. Constantly, Python development company are growing rapidly with the increasing demand of Python web app development. Thanks for sharing! Keep sharing.