A simple Python script that calculates the factorial of a non-negative integer.
This Python script provides a function to calculate the factorial of a non-negative integer. Factorial is defined as the product of all positive integers from 1 to the given integer.
Example:
- Factorial of 5 (written as 5!) is 5 x 4 x 3 x 2 x 1 = 120.
To use the factorial calculator, simply call the factorial
function with a non-negative integer as an argument. Here's an example of how to use it in your Python code:
from factorial_calculator import factorial
num = 5
result = factorial(num)
print(f"The factorial of {num} is {result}")
Follow these steps to get started with the Python Factorial Calculator:
- Clone this repository to your local machine:
git clone https://github.com/abdullahguch/factorial-calculator.git
-
Install Python (if not already installed). You can download it from python.org.
-
Navigate to the project directory:
cd python-factorial-calculator
- Run the script to calculate the factorial:
python factorial_calculator.py
- Follow the on-screen instructions to enter a non-negative integer and see the factorial result.
Contributions are welcome! If you have any suggestions, bug reports, or would like to contribute new features, please follow these steps:
-
Fork the repository.
-
Create a new branch for your feature or bug fix:
git checkout -b feature-name
- Make your changes and commit them:
git commit -m "Add your feature or bug fix description"
- Push your changes to your fork:
git push origin feature-name
- Create a pull request on the original repository.
Remember to replace "feature-name"
with a descriptive branch name when creating contributions.
This project is licensed under the MIT License, which allows you to use, modify, and distribute the code for both personal and commercial purposes. See the LICENSE file for more details.