We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aea8ecd commit 725e3d6Copy full SHA for 725e3d6
divisors_of_a_number.py
@@ -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