forked from werhereitacademy/Python_Modul_Week_3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek_3_cs_qs_2.py
More file actions
28 lines (24 loc) · 767 Bytes
/
week_3_cs_qs_2.py
File metadata and controls
28 lines (24 loc) · 767 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
26
27
28
def get_user_input():
user_input_number = int(input("Give e number: "))
return user_input_number
def split_number(number):
digits = [int(digit) for digit in str(number)]
return digits
# Call the function to get user input and print the result
number = get_user_input()
digits = split_number(number)
print(f"The digits of the number {number} are: {digits}")
def divisor(digits):
divisors = []
for i in digits :
if i == 0:
continue
elif number % i == 0:
divisors.append(i)
return divisors
result = divisor(digits)
count_divisors = len(result)
if count_divisors > 0:
print(f"The number {number} has {count_divisors} divisors.")
else:
print("The number is zero, so it has no divisors.")