forked from souravjain540/Basic-Python-Programs
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprime.py
More file actions
Latest commit
20 lines (19 loc) · 518 Bytes
/
Copy pathprime.py
File metadata and controls
20 lines (19 loc) · 518 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
defprime(x, y):
prime_list= []
foriinrange(x, y):
ifi==0ori==1:
continue
else:
forjinrange(2, int(i/2)+1):
ifi%j==0:
break
else:
prime_list.append(i)
returnprime_list
starting_range=2
ending_range=7
lst=prime(starting_range, ending_range)
iflen(lst) ==0:
print("There are no prime numbers in this range")
else:
print("The prime numbers in this range are: ", lst)