Listing 08-19: Input module (entry

##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 08\08.19 - Input module (entry.py).py
# Description: Input module (entry.py)
##############################################################################

def integer_validation(message, minimum, maximum):
    while True:
        try:
            v = int(input(message))
            if v >= minimum and v<= maximum:
                return v
            else:
                print(f"Enter a value between {minimum} and {maximum}")
        except ValueError:
            print("You must enter an integer")
Click here to download the file