I am new to python and I am required to create a factorial function. I have created a function that gives the factorial of a number but I want some help from stackflow community.
Here is my code
a = 5
b = 1
for i in range(1,a+1):
b = b * i
print b
And this is my output:
I am getting 120 (factorial value) but I am also getting other values like 1, 2, 6. How can I only print factorial value and not other values.

Unindent the
printstatement so that it is only executed after the loop instead of within it, for every step.