Skip to main content

A simple Python module designed to calculate the factorial of a non-negative integer.

Project description

Factorial Calculator

This Python module, simple_factorial, is a versatile and user-friendly tool designed to calculate the factorial of a non-negative integer. The factorial of a non-negative integer n is the product of all positive integers from 1 to n. This module provides a reliable way to compute factorials, handling various scenarios, including input validation and error handling.

Table of Contents

Installation

To use the simple_factorial module, you can simply import it into your Python project. There is no need for a separate installation process. Make sure the factorial.py file is in the same directory as your Python script, or you can place it in a directory that is in your Python module search path.

pip install simple_factorial

Usage

You can use the calculate_factorial function provided by the factorial.py module to calculate the factorial of a non-negative integer. Here's a basic example:

import simple_factorial

result = simple_factorial.factorial(5)
print(result)  # Output: 120

Documentation

The factorial.py module includes detailed documentation in the form of docstrings. These docstrings provide information about the module's purpose, function arguments, return values, and usage examples. You can access this documentation using Python's built-in help() function or by viewing the docstrings directly in your code editor.

import simple_factorial

help(simple_factorial.factorial)

Features

  • Input Validation: The module ensures that input is a non-negative integer and handles negative numbers gracefully.

  • Error Handling: If an invalid input is provided, the module raises a ValueError with an informative error message.

  • Interactive Mode: When run as a script, the module enters an interactive mode, allowing users to calculate factorials for multiple numbers until they choose to quit.

  • Documentation: The module includes docstrings that provide information about its purpose, usage, and examples, making it easy for users to understand and use.

Contributing

Contributions to this project are welcome! If you'd like to improve the module, fix a bug, or add a new feature, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and test them thoroughly.
  4. Commit your changes and push them to your fork.
  5. Open a pull request against the original repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.


This `README.md` file provides an overview of your project, including installation instructions, usage examples, documentation access, features, contribution guidelines, and licensing information. You can further customize it to match the specifics of your project if needed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_factorial-0.0.2.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_factorial-0.0.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file simple_factorial-0.0.2.tar.gz.

File metadata

  • Download URL: simple_factorial-0.0.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.0

File hashes

Hashes for simple_factorial-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ab00c3fb714d1597375eece9f80fb8e683745b155609a60b92db8217e04db9b5
MD5 d8a646afe43c3110fa4a17ad8f5c803b
BLAKE2b-256 7cae239a8ad06a6f59bbda85d923e59b2711eab3677b8dce465d51de1cceb27c

See more details on using hashes here.

File details

Details for the file simple_factorial-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_factorial-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 744d481105ef6d0232a773835df3af7761e313e6897114917606a57592cfe6da
MD5 b72c307ed73d456a97ce5f362af150af
BLAKE2b-256 03cdf307999e018d16fd830d1703f745bb0a6a326a624f665ed2b17990c50882

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page