forked from geekcomputers/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aea8ecd
commit 725e3d6
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
a = 0 | ||
while a<= 0 : | ||
number_to_divide = input("choose the number to divide -->") | ||
try : | ||
a = int(number_to_divide) | ||
except ValueError : | ||
a = 0 | ||
if a <= 0 : | ||
print('choose a number grether than 0') | ||
list_number_divided = [] | ||
|
||
for number in range(1,a + 1) : | ||
b = a % number | ||
if b == 0 : | ||
list_number_divided.append(number) | ||
print('\nthe number ' + number_to_divide + ' can be divided by:') | ||
for item in list_number_divided : | ||
print(f'{item}') | ||
if len(list_number_divided) <= 2 : | ||
print(number_to_divide + ' is a prime number') |