forked from kal179/Beginners_Python_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprimeNumbers.py
More file actions
25 lines (22 loc) · 713 Bytes
/
primeNumbers.py
File metadata and controls
25 lines (22 loc) · 713 Bytes
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
# Prime number Determiner
# replace input() with raw_input() in Python version 2.7 input() works with version 3
while True:
startOrEnd = str(input('Start or End : '))
if startOrEnd == 'Start':
toCheckNum = int(input('Number to Check : '))
if toCheckNum > 1:
for x in range(2, toCheckNum):
if toCheckNum % x == 0:
print(str(toCheckNum) + ' is divisible by ' + str(x))
print(str(toCheckNum) + ' is not a Prime number')
break
elif toCheckNum % x > 0:
print(str(toCheckNum) + ' is a prime number')
break
continue
else :
print(str(toCheckNum) + ' is not a prime number')
continue
else :
print('Progarm Ended...')
break