DEV Community

loading...

Day 11 of 100DaysOfCode: Python Program to find the factorial of number

iamdurga profile image Durga Pokharel ・1 min read

This is my 11th day of #100daysofcode.

Today I learned about more properties of CSS from freecodecamp. And I also tried to write a simple python code to find factorial of number.

Python Program to Find Factorial of Number

My code is simple. At first users give integer type number. I initialized factorial as 1. There is a loop from range 1 to n + 1 and gave the condition. At last I print the factorial.

n = int(input("enter the number"))
factorial = 1
for i in range(1,n+1):
    factorial *= i

print(f"factorial of {n} = {factorial}")

Enter fullscreen mode Exit fullscreen mode

Discussion (2)

pic
Editor guide
Collapse
otumianempire profile image
Otu Michael

Your code is short this time. It is good. Today, you did well with the variable names...

Collapse
iamdurga profile image
Durga Pokharel Author

Yesterday I did thats muchπŸ™‚