Hello, buddies! Today we’ll learn to use the factorial function son we don’t crash our brain trying to figure out how to make a factorial calculator by ourselves with a loop like in WSQ09.
There’s a magic bunch of functions already settled on python that you can use. There’s no reason for you to create a solution for a problem if you can use a module.
Here’s my example:
Instead of doing the while loop, you can import the “math” library and the command to get the factorial is math.factorial(name-of-the-variable). Like in the example above. You can check this webpage to know more about this topic.
Have a nice day!!!
Let’s use a library by paogarcia2401 is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.