Skip to main content

A package for tools in Python

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.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-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: calctool-0.1.0.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.tar.gz
Algorithm Hash digest
SHA256 1431f79e7a2ca1ca7bb4daf51fafe0c61ea1d75c3dcff93c97cffb97bdd742f1
MD5 34f39a567c03095c70a71e4ed040bd7c
BLAKE2b-256 b7015ac71579ab59ccf62b554a3ee0ad7aff930b2598b73ab37b721b009f4506

See more details on using hashes here.

File details

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

File metadata

  • Download URL: CalcTool-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 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-py3-none-any.whl
Algorithm Hash digest
SHA256 2c6e0b4e08540f00b0965c6226ef11b85b82f91bf3dd06e28349a884c56441ef
MD5 5cdf0de345a43c353ee08630fd93b384
BLAKE2b-256 ab4a08026c2a29b1740ceb836abf012870c128128ca6628dbd91ae3efeda2a99

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