Skip to main content

计算阶梯扣率或阶梯分成的一组方法

Project description

StepRate

Step Rate Compute

计算阶梯扣率或阶梯分成的一组方法

Github地址

为学习如何打包成pypi包编写的简易代码,仅供参考

参数

amount 待计算的金额 rate 阶梯扣率设定 deduction 扣除数

设定阶梯扣率的格式

数组的阶梯扣率,最后一个元素必须是包含有-1tuple

rate = [
        (10000,10),
        (20000,15),
        (30000,20),
        (40000,25),
        (50000,30),
        (-1,50),
    ]

计算类型

全量计算

type=1或者type='full',返回值是一个数字

全量阶梯

type=2或者type='stepfull',返回值是一个数字

溢出阶梯

type=1或者type='stepover',返回值是一个数组,可以计算合计费用

设定计算类型的例子

obj = steprate()
obj.type = 1
obj.type='full'

例子

    rate = [
        (10000,10),
        (20000,15),
        (30000,20),
        (40000,25),
        (50000,30),
        (-1,50),
    ]
    
    obj = steprate()
    obj.compute(70001, rate, 10000,'stepover')
    rst = obj.result
    
    print(rst)
    
    # 计算结果 15000.5

    print(obj.results)

    # 计算结果 [1000.0, 1500.0, 2000.0, 2500.0, 3000.0, 5000.5]

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

steprate-0.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

steprate-0.0.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file steprate-0.0.0.tar.gz.

File metadata

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

File hashes

Hashes for steprate-0.0.0.tar.gz
Algorithm Hash digest
SHA256 73adbdc883b608fb66fa9807393094cb0bc9662cf1ce51e8ec0c5ed67e294123
MD5 ac55554462e938d8f48be81906df3c3b
BLAKE2b-256 0cd7ea59b49dc68eeec7986556ca2216f7ea7bf163ff759ef0ad32a049aee042

See more details on using hashes here.

File details

Details for the file steprate-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: steprate-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for steprate-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ec6047f42ed325f7c0928b93b0623b1fad109a82fde51700e5cb9a6abe10820
MD5 f0472a6fe5345ac00ff30f594361e45b
BLAKE2b-256 ab3c015a06818b2e3744b889032dcae2a0083ede23b8c1acaf3175850dda56fc

See more details on using hashes here.

Supported by

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