-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFind Digits
More file actions
47 lines (29 loc) · 659 Bytes
/
Find Digits
File metadata and controls
47 lines (29 loc) · 659 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the findDigits function below.
def findDigits(n):
d=str(n)
list1=[]
c=0
for i in range(0,len(d)):
list1.append(int(d[i]))
print(list1)
for j in range(0,len(list1)):
if list1[j] != 0:
if n%list1[j]==0:
c=c+1
else:
continue
return c
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
t = int(input())
for t_itr in range(t):
n = int(input())
result = findDigits(n)
fptr.write(str(result) + '\n')
fptr.close()