Problem
Write a program to find a factorial of a given number.
Examples
6! = 720, 5! = 120, 4! = 24
Dos
- Try to solve it in a most simple and efficient way.
- Share your codes in the comments (in any language), I'll find some bugs ๐.
- Feel free to mention if you find any bugs in my code ๐ง.
- Share some challenges in the comments, I'll solve them in my next blog post.
Don'ts
- Never see my code before solving it on your own.
Code
import math
num = 5
print(math.prod([i for i in range(1, num + 1)]))
I've used Python for solving this challenge, but if you want the same solution in some other languages let me know in the comments ๐.