Skip to main content

Tools for calculations

Project description

导入 Import

from CalcTool import *

*发现任何bug或问题,请反馈到tommy1008@dingtalk.com,谢谢!

*If you find any bugs or issues, please report them to tommy1008@dingtalk.com, thank you!

排序工具 SortTool

def sort(arr: List[Any], key: Callable[[Any], Any] = lambda x: x, reverse: bool = False) -> None:

示例代码:使用内置的abs函数作为key,即以绝对值大小排序。

Example code: Use the built-in abs function as the key to sort by absolute value.

>>> numbers = [-5, 3, -2, 1, 4]
>>> sort(numbers, key=abs)
>>> print(numbers)
[1, -2, 3, 4, -5] 

内省排序Introsort,结合了多种排序算法的优点,以确保在各种情况下都能获得高效的性能,不返回列表。 arr,待排序的列表。key,用于比较的键函数,自定义排序规则,而不必修改原始数据。reverse,是否降序排列,默认为升序。

Introsort, which combines the advantages of multiple sorting algorithms to ensure efficient performance in all cases. Does not return a list. arr is the list to be sorted. key is a function to extract a comparison key from each element, allowing custom sorting without modifying the original data. reverse specifies whether to sort in descending order (default is ascending).

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

calctool-0.1.0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

CalcTool-0.1.0.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file calctool-0.1.0.1.tar.gz.

File metadata

  • Download URL: calctool-0.1.0.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for calctool-0.1.0.1.tar.gz
Algorithm Hash digest
SHA256 9270103c964a73023c068d85378a24865b2047c5bca971de13aa9166d2bbbd58
MD5 db6d75b78ffa56f476ad140dcb39451e
BLAKE2b-256 1a0774731d50858dacb51d92fe5b04b5909bddd509a4777782d9b5fe038ed42f

See more details on using hashes here.

File details

Details for the file CalcTool-0.1.0.1-py3-none-any.whl.

File metadata

  • Download URL: CalcTool-0.1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for CalcTool-0.1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8fe8d1b53db7681d2a6160a0aededbe0a8136faf8ab7552e2bf271e20dc45dd8
MD5 7f0cb009fd9152b78fa1a3d03e3bf86e
BLAKE2b-256 b461805f8eeb0ac7a8f0fa65dfc4a339587ae10e6fe1598a3669e3a6a24acc46

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