Skip to main content

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.0.tar.gz (93.7 kB view details)

Uploaded Source

Built Distribution

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

kousuan-0.1.0-py3-none-any.whl (157.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kousuan-0.1.0.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

Hashes for kousuan-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6e3f72afbbbf33c8a10d1e7122aca79c9d70254f151cd10de44b53dd06353107
MD5 b9b4198a82467b5c5d1a37d6adbddd2f
BLAKE2b-256 97e3a328c4597267e9c8b1fa3183ffb795e532d25373fd26ffe298419ed4c530

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kousuan-0.1.0-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

Hashes for kousuan-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e8db5f1d3f5297bc58f5bcc7e047d1ac28afc7f56b5968032f62befaf96ae02
MD5 c949723d32abe715b27345b91ab007a7
BLAKE2b-256 f5f5d8ae405e38373c4d6a6565941d10189290cc263ded806b593d0233edab65

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