-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (25 loc) · 806 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from prime.generator import prime_generator
def generate_prime():
try:
start = int(input("Enter range start: "))
end = int(input("Enter range end: "))
print("The prime numbers found in the range are:")
for p in prime_generator(start, end):
print(p)
print("\n")
except ValueError:
print("Oops! Please enter a valid integer.\n")
print("Welcome to the Interactive Prime Number Generator!")
while True:
print("\nEnter choice: ")
print("=======================")
print("Generate prime numbers: P")
print("Exit: Q")
choice = input().upper()
if choice == "P":
generate_prime()
elif choice == "Q":
print("The end.")
break
else:
print("Invalid choice. Please enter again.")