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

Uploaded Python 3

File details

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

File metadata

  • Download URL: intinput-1.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 8a944d4d2eace337ccd591e8f8ac266008fa76cd78620bbe7a0d2cf0c641f830
MD5 a8b6b4df1c1aeb2660aed7c27a893d77
BLAKE2b-256 de4a0dd74b5c445a54252698f5f68d59a0b08ba56f443923e45572923f369a97

See more details on using hashes here.

File details

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

File metadata

  • Download URL: intinput-1.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbc7dc148bdb2b5871bbb345f2b923476297c21ede7f3e2920860311ca68784c
MD5 bbbfb43fbd39e62f0606a4ffd8c29172
BLAKE2b-256 d7ea600c42f85736f3e5474321fccc776658fe5263f233b02c1f55fcd28a0700

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