Skip to main content

Simple utility functions for KEC's Intro To Programming: Python Course

Project description

KEC ITP: Python Util Functions

Functions

kecutil.reduce(cb(cur, val), list, default) Reduce is used to reduce a list to one value. This is commonly useful when finding the longest string for example

from kecutil import reduce


strings = ["ab", "acb", "abcdef", "abd"]
longestString = reduce(lambda x, y: x if len(x) > len(y) else y, strings, "")

print(longestString) # "abcdef"

kecutil.clearConsole() Clears the console window

kecutil.clamp(value: int,length=2) Clamps a float to have the same number of decimals as the length Returns a new float

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

kecutil-0.0.6.tar.gz (2.0 kB view details)

Uploaded Source

File details

Details for the file kecutil-0.0.6.tar.gz.

File metadata

  • Download URL: kecutil-0.0.6.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for kecutil-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c4365d18f9e7953cd338983408603c6a2ff59875926efb9be6a7ada75b6db91e
MD5 283a075d97bdfe0c5e73014c775251fd
BLAKE2b-256 a67d901108209da7735e09a5f85597c6141c4786c7009652ea9474679156f807

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