Skip to main content

A package with some usual general functions and objects

Project description

K-General-Kit 🛠️

This project aims to provide a rich set of useful general functions frequently needed and frequent objects.

Features 💡

  • It contains a general library, for general functions on containiers, string, a bit of mathematics
  • We also find a search_sort library, with powerful search and sort algorithms going from the sequential search to the exponential search and from the select sort to the merge sort.
  • We also have the gen_obj library for frequents objects like math constants with the ability to ameliorate their precisions
  • We also have eval_sequence, which gives powerful functions to evaluate recursive functions, bypassing the recursivity.
  • Thera are also an interesting set of datas going from prime numbers collections to txt dictionnaries (for words counting functions).

Examples of use 📝

from k_general_kit.gen_func import all

print(nel(45)) # prints "quarante cinq"

print(words_sentence("Hello, everyone!", 'en')) # prints "['Hello', 'everyone']"
import k_general_kit.search_sort as ks

tab = [1, 4, 0, -1, 8, 9]

tab_heap = ks.Heap(tab)

print(tab_heap.elements) # prints [-1, 0, 1, 4, 8, 9]

print(tab_heap) # Heap representation of tab before sorting

""" Result
       1 
     ↙   ↘   
   4       0 
  ↙ ↘     ↙ ↘  
-1   8   9 
"""

tab_heap.sort()

print(tab_heap) # Heap representation of tab after sorting

""" Result
      -1
     ↙   ↘   
   0       1 
  ↙ ↘     ↙ ↘  
 4   8   9 
"""
import k_general_kit.search_sort as ks

tab = [1, 4, 0, -1, 8, 9]

ks.merge_sort(tab, start=0, end=-1, ord=1) # We sort tab in the descending order

print(tab) # Result: [9, 8, 4, 1, 0, -1]

ks.quick_sort(tab, start=0, end=-1, ord=0) # We sort tab in the ascending order

print(tab) # Result: [-1, 0, 1, 4, 8, 9]

print(ks.exp_search(0, tab, start=0, end=-1)) # We use exp_search since tab is now sorted, and which is better that dich_search for large tabs

""" Result: 1 """

print(ks.interpol_search(2, tab, start=0, end=-1)) # We use interpol_search since tab is now sorted and which is the best search algorithm for general tabs

""" Result: -1 """

For more tests, use in the project directory the command python -m tests.eval_func or the built-in command in .vscode

Author ✍️

This project was created by KpihX. You can contact me at kapoivha@gmail.com for any questions or suggestions.

License 📄

This project is licensed under the MIT license - see the LICENSE file for more details.

: https://github.com/KpihX

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

k_general_kit-1.2.0.tar.gz (23.0 MB view details)

Uploaded Source

Built Distribution

k_general_kit-1.2.0-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file k_general_kit-1.2.0.tar.gz.

File metadata

  • Download URL: k_general_kit-1.2.0.tar.gz
  • Upload date:
  • Size: 23.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for k_general_kit-1.2.0.tar.gz
Algorithm Hash digest
SHA256 fdce7f77c2f8835d83c41b75a1819af28424d69a7b29666263c8e6a9658ec7ef
MD5 23df9faba5282abee0d7d5e81461cb83
BLAKE2b-256 93103d14b0d5f0fe8f3805df83ed4404f56988b4b17b04678b09213b63e64aed

See more details on using hashes here.

File details

Details for the file k_general_kit-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for k_general_kit-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cad61e60727047ec71f8fca4b094bd4a72fe847df1c0c8ce7537537f237d3932
MD5 04abdfa4b26f9dfbd52622a71c8494c9
BLAKE2b-256 890fc4897777734228202700fe727d1c853f9b8c4ff82b0551d6b1b168800807

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