Skip to main content

A intput function that only reads intergers

Project description

Intinput Function

This repository contains a Python function named intinput which prompts the user to input an integer value. If the user inputs a non-integer value, the function will display an error message and prompt the user again until a valid integer is entered.

Parameters

  • prompt (str): The message displayed to the user when asking for input.
  • err (str, optional): The error message displayed when the user inputs a non-integer value. Defaults to "Invalid input, please enter an integer.".

Installation

!pip install intinput

Example Usage

- Without Error Command

from IntInput.INIP import intinput

# Using the function with the default error message
result = intinput("Enter an integer: ")

# Use the result in your code
print("You entered the number:", result)

- With Error Command

from IntInput.INIP import intinput

# Store the returned value in a variable
result = intinput("Please enter a number: ", "This is not a number, try again.")

# Use the result in your code
print("You entered the number:", result)

License

MIT License

Copyright (c) 2024 [Sibi Gokul]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

intinput-1.3.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

intinput-1.3.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file intinput-1.3.0.tar.gz.

File metadata

  • Download URL: intinput-1.3.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for intinput-1.3.0.tar.gz
Algorithm Hash digest
SHA256 cfa2e4296aeda50e4986492e91d7a7fa7e66471906527d3d61b39fb3916a6173
MD5 ed5bbee8e41d316cff7870d4d2aaa58d
BLAKE2b-256 46157394f26aa434aff53eb4d9e7ed2378b04d62d116ce2dd5a222828355551c

See more details on using hashes here.

File details

Details for the file intinput-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: intinput-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for intinput-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1cc16df76827c35077a43d281b5924947e64dba2e84f81e3b80195e7ffe0cf6c
MD5 bdb1e95b48572232b76c75ec5f50ba1f
BLAKE2b-256 6be1aa66eb761593c06cfebf4495c6b92a0aca4915fca68ff027f1ca3fc58144

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