Skip to content

Commit 725e3d6

Browse files
committed
Add Dani555555 to Contributors list
1 parent aea8ecd commit 725e3d6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

divisors_of_a_number.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
a = 0
2+
while a<= 0 :
3+
number_to_divide = input("choose the number to divide -->")
4+
try :
5+
a = int(number_to_divide)
6+
except ValueError :
7+
a = 0
8+
if a <= 0 :
9+
print('choose a number grether than 0')
10+
list_number_divided = []
11+
12+
for number in range(1,a + 1) :
13+
b = a % number
14+
if b == 0 :
15+
list_number_divided.append(number)
16+
print('\nthe number ' + number_to_divide + ' can be divided by:')
17+
for item in list_number_divided :
18+
print(f'{item}')
19+
if len(list_number_divided) <= 2 :
20+
print(number_to_divide + ' is a prime number')

0 commit comments

Comments
 (0)