Skip to main content

Maximal simplification of Input / Output for text programs.

Project description

Latest Version Supported Python versions

koinput

Maximal simplification of Input / Output for text programs.

PyPI for releases | Github for source

Installation

Requirements colorama library.

pip install koinput

How to use

Inputs

The library has two types of inputs:

  • int_input

  • float_input

They have the same settings and differ only in the type of output.

Explanation of input parameters

def int_input(input_suggestion="", greater=float('-inf'), less=float('inf'), console_style=colorama.Fore.RESET,
              error_message='Invalid number format.\n', error_message_style=colorama.Fore.RED,
              input_is_greater_than_less_error="The number is greater than acceptable.\n",
              input_is_less_than_greater_error="The number is less than acceptable.\n",
              input_is_less_error_style=None, input_is_greater_error_style=None,
              strictly_greater=True, strictly_less=True):
input_suggestion=""

Input suggestion that will be displayed when the function is run.

greater=float('-inf'), less=float('inf')

The range in which the entered number should be included.

strictly_greater=True, strictly_less=True

Controlling the mathematical strictly of comparisons.

console_style=colorama.Fore.RESET

Sets the base display style for the terminal. I recommend using the colorama library for easier style customization. You can also use standard sequences (example: “x1b[39m”).

error_message='Invalid number format.\n'

Error message when converting input to number.

error_message_style=colorama.Fore.RED

Error message style.

input_is_greater_than_less_error="The number is greater than acceptable.\n"

The message issued when the number is greater than allowed.

input_is_less_than_greater_error="The number is less than acceptable.\n"

The message issued when the number is less than allowed.

input_is_less_error_style=None, input_is_greater_error_style=None

Out of range error styles.

Usage example

def area_triangle(base, height):
    return 0.5 * base * height

print(area_triangle(float_input(input_suggestion='Enter the base of the triangle: '),
                    float_input(input_suggestion='Введите высоту треугольника: ')))
mas = [randint(0, 999) for i in range(int_input(input_suggestion="Enter the size of the array: "))]

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

koinput-0.2.0.3.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

koinput-0.2.0.3-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file koinput-0.2.0.3.tar.gz.

File metadata

  • Download URL: koinput-0.2.0.3.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/4.4.0-19041-Microsoft

File hashes

Hashes for koinput-0.2.0.3.tar.gz
Algorithm Hash digest
SHA256 a3c584c9155536ee6c7a9e3e4d3ca2e7fd5426f35d1fe58bb3b13076e313e172
MD5 5c8f1d4d7a304ce06f3fdfad0b608f7f
BLAKE2b-256 6eb7bb1e7faaf80c5a8b0dabe5c2f7ad29f262d5187ebf953a1eb949cb87915d

See more details on using hashes here.

File details

Details for the file koinput-0.2.0.3-py3-none-any.whl.

File metadata

  • Download URL: koinput-0.2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/4.4.0-19041-Microsoft

File hashes

Hashes for koinput-0.2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5e922230ee2fdb75229c881cfa6520bce010d0c0bbbf11cdb6f2e78c31b370d6
MD5 3958c9304ffc524164bfa7c77320f405
BLAKE2b-256 c6045aba45db0e68bb4bbffef65bb890cc638ca657a0e5b36340e9e087804e2c

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