Answer:
Following are code of factorial in python language
def factorial(n): # function
result=1 #variable
for x in range(2,n+1): #iterating the loop
result=result*x #storing result
return result #return result
for n in range(10): #iterating loop
print(n,factorial(n)) #print factorial
Output:
Following are the attachment of output
Explanation:
Missing information :
In the question the information is missing the code is missing which we have to correct it following are the code that are mention below.
def factorial(n): # function
result=1 #variable
for x in range( ): #iterating the loop
result= #storing result
return #return result
for n in range( ): #iterating loop
print(n,factorial(n)) #print factorial
Following are the description of code
- We have create a function factorial in this we have pass the one parameter i.e "n".
- In the for loop we have pass 2,n+1 which has been used to iterating the loop calculating factorial and string the result in the result variable
- In the main function we have pass the range on which we have to calculated the factorial
- Finally the print function will print the factorial .
Following are the attachment snip of code in the python language