Skip to main content

一个简单的加减乘除计算包,完美演绎了Python包的应用过程。

Project description

🧮 Poorcal

Poorcal (Poor Calculator) 是一个简单的计算器项目示例,包含了最基本的 加减乘除 函数,并提供了同名命令行工具,完美演示了Python包的应用过程,适合初学者参考。


📌 更多学习内容,请参考 Python项目全流程指南


🚀 安装方法

要求 Python 3.12 及以上版本,通过 pip 快速安装:

pip install poorcal

📚 使用示例

基本用法

from poorcal import Calculator

# 创建计算器实例
calc = Calculator()

# 执行基础算术运算
print(calc.add(2, 3))       # 输出:5
print(calc.subtract(10, 4)) # 输出:6
print(calc.multiply(5, 6))  # 输出:30
print(calc.divide(8, 2))    # 输出:4.0

# 处理除零异常(会抛出 ValueError)
try:
    calc.divide(5, 0)
except ValueError as e:
    print(e)  # 输出:不允许除以零

命令行用法

poorcal默认提供了poorcal命令行工具,使用方式如下:

poorcal "1 + 2"
poorcal "3 - 1"
poorcal "2 * 3"
poorcal "8 / 2"

📜 许可证

本项目基于 MIT 许可证开源 - 详见 LICENSE 文件。


📞 支持与反馈

如果有任何问题或建议,欢迎在 GitHub 上提交 Issue。

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

poorcal-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

poorcal-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file poorcal-0.1.0.tar.gz.

File metadata

  • Download URL: poorcal-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for poorcal-0.1.0.tar.gz
Algorithm Hash digest
SHA256 df49e47bc55c8c93645608dab94836beea6de0a873d8b6ab4f39b310ce041a18
MD5 e2431362577d181446b873579fd36576
BLAKE2b-256 8294f48556ade3a8692c5883a852704b60de108bcda0ebc022102e56a27881c3

See more details on using hashes here.

File details

Details for the file poorcal-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: poorcal-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for poorcal-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e8987de872e5bdf75b801e5acc3116634d961658365723042b401923b6ac8fd
MD5 7f5588946f7f9fc745634b50256b2efd
BLAKE2b-256 56b85b5c5d3903d71b54ee53ee8be513be23b8912ef023a4c51fd406b99678be

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