# ISM01- what's wrong with my submission?

import sys
def calc(t):
q=0;
while(t>0):
q=q+int(t%10);
t=t//10
print(q,file=sys.stdout)
n=list();
s=int(input());
for i in range(s):
n.append(int(input()));
for p in n:
m=1;
for i in range(p+1):
if(i==0):
pass;
else:
m=m*i;
calc(m);

After few debugging s i found this to be perfect. But still it s showing as an error…

Why are you taking the input for s??? There is no point of test cases in that question and you are expected to read the input till the end of the file. Once read the question again

DON’T TAKE THE INPUT FOR TEST CASES

to find factorial of large numbers u can directly use inbuilt functions like math.factorial(num) which makes ur implementation easier

Understand the INPUT section of the problem clearly:

The input file will contain one or more test cases. Each test case consists of one line containing an integers n (n<=1000).

Here first number in the input does not indicate number of testcases. So you have read the numbers until EOF.

Also always remember to read input from STDIN and write output to STDOUT.

My primary language in not Python but I tried solving this problem in python but for some reason I get NZEC error (If somebody finds the error feel free to edit the code), but still it might help you.

``````import sys

def calcSum(t) :
q = 0
while (t > 0) :
q = q + int(t % 10)
t = t // 10
print q

fact = []

for i in range(1001) :
fact.append(1)

for i in range(2, 1001) :
fact[i] = fact[i-1] * i

while True :
inp = 0
try:
inp = int(raw_input())
calcSum(fact[inp])
except EOFError:
break
``````

Hope it helps, Best Luck

//