The Best Way to Request User Input in Python

Installation

pip install pyinputplus

Usage

import pyinputplus as pyinput

prompt = 'How old are you:'
age = pyinput.inputInt(prompt=prompt, greaterThan=0)

Example Output

How old are you:-1
Number must be greater than 0.
How old are you: 11.5
'11.5' is not an integer.
How old are you: 14