Print All Prime Numbers in an Interval

PHOTO EMBED

Fri Nov 25 2022 12:10:42 GMT+0000 (Coordinated Universal Time)

Saved by @KarenHolton #education #assignment #homework #student #study #university #python #programming

def prime(x, y):
    prime_list = []
    for i in range(x, y):
        if i == 0 or i == 1:
            continue
        else:
            for j in range(2, int(i/2)+1):
                if i % j == 0:
                    break
            else:
                prime_list.append(i)
    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")
else:
    print("The prime numbers in this range are: ", lst)
content_copyCOPY

https://www.solidworksassignmenthelp.com/do-my-solidworks-assignment/