A Python package for providing mental arithmetic calculation skills
Project description
Kousuan Skill
一个提供口算计算技巧的Python包,帮助提高心算能力和数学计算技巧。
功能特性
- 基础四则运算
- 快速加法技巧
- 快速乘法技巧
- 数字分解
- 百分比计算
- 乘法表生成
- 心算技巧集合
安装
pip install kousuan
使用方法
命令行工具
# 加法
kousuan add 15 27
# 减法
kousuan subtract 50 23
# 乘法
kousuan multiply 12 8
# 除法
kousuan divide 100 4
# 百分比计算
kousuan percentage 200 15
# 快速加法
kousuan qadd 5 10 15 20
# 快速乘法
kousuan qmul 2 3 4 5
# 数字分解
kousuan decompose 84
# 查看心算技巧
kousuan tricks
# 生成乘法表
kousuan table 7
kousuan table 9 --limit 15
Python API
import kousuan as ks
# 基础运算
result = ks.add_numbers(15, 27)
result = ks.multiply_numbers(12, 8)
# 快速计算
numbers = [5, 10, 15, 20]
sum_result = ks.quick_addition(numbers)
product_result = ks.quick_multiplication(numbers)
# 数字分解
factors = ks.number_decomposition(84)
# 获取心算技巧
tricks = ks.mental_math_tricks()
# 生成乘法表
table = ks.get_multiplication_table(7)
心算技巧
本包包含多种心算技巧,包括:
- 乘以11的技巧:两位数乘以11时,将两个数字相加,结果放在中间
- 乘以5的技巧:乘以10再除以2
- 乘以9的技巧:乘以10再减去原数
- 以5结尾的数字平方:将前一位数字乘以(前一位数字+1),后面加上25
- 百分比计算:计算10%时,将小数点左移一位
开发
安装开发依赖
pip install -e .[dev]
运行测试
pytest
代码格式化
black kousuan/
flake8 kousuan/
许可证
MIT License
作者
liandong
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
kousuan-0.1.1.tar.gz
(93.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
kousuan-0.1.1-py3-none-any.whl
(157.8 kB
view details)
File details
Details for the file kousuan-0.1.1.tar.gz.
File metadata
- Download URL: kousuan-0.1.1.tar.gz
- Upload date:
- Size: 93.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d48d0f8bc58e094afc6938118e9a83781596ca9093a6d86a295acf8e9584e5d
|
|
| MD5 |
06242c74aa31099ed127675379e549b3
|
|
| BLAKE2b-256 |
256ba60c34895cfebd62a402c0aab589a79d8ad6e02b8ae56af55d7307cc5403
|
File details
Details for the file kousuan-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kousuan-0.1.1-py3-none-any.whl
- Upload date:
- Size: 157.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2e2209700a735664df1a49fc733cdef1a46e062de1fc4f0bc0a8b20c9560ab7
|
|
| MD5 |
4edfa4b92cc59774fd7aae239f00f1bf
|
|
| BLAKE2b-256 |
2627ddd69b0a394fc876ae9e7ff955a760511725767014fc7d748eb52dbc03e8
|