even if code correct ans show wrong.what is different between these two.
n = int(input())
factorial = 1
for i in range(1, n + 1):
factorial = factorial * i
print(‘factorial of’, n, ‘is’, factorial)
my answer.
n = int(input())
factorial = 1
for i in range(1, n + 1):
factorial = factorial * i
print(‘factorial of’, n, ‘is’, factorial)
solution
what’s wrong in this
Please write your code with indentation. May be the indentation of print in causing the wrong output(multiple outputs)
- Both of the codes given by you are identical.
- There are multiple test cases in the problem.
You have to print only the factorial. i.e. print(factorial)
remove the extra words. Always check the output format.