Listing 08-10: Integer validation using function

##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 08\08.10 - Integer validation using function.py
# Description: Integer validation using function
##############################################################################

def range_int(question, minimum, maximum):
    while True:
        v = int(input(question))
        if v< minimum or v > maximum:
            print(f"Invalid value. Please enter a value between {minimum} and {maximum}")
        else:
            return v
Click here to download the file