-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFind digits
More file actions
40 lines (32 loc) · 794 Bytes
/
Find digits
File metadata and controls
40 lines (32 loc) · 794 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
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'findDigits' function below.
#
# The function is expected to return an INTEGER.
# The function accepts INTEGER n as parameter.
#
def findDigits(n):
# Write your code here
for i in range(t):
c=0
ls=list(map(int,str(n)))
for i in range(0,len(ls)):
try:
if n%int(ls[i])==0:
c+=1
except ZeroDivisionError:
continue
return c
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
t = int(input().strip())
for t_itr in range(t):
n = int(input().strip())
result = findDigits(n)
fptr.write(str(result) + '\n')
fptr.close()