#validWhile.py #data validity checking examples num = eval(input("Enter a number between 1 and 10: ")) #true if invalid, i.e. out of range while num<1 or num>10: print("Error. Invalid data. Try again.") num = eval(input("Enter a number between 1 and 10: ")) print("It's now between 1 and 10, inclusive:", num) num = eval(input("Enter 2, 4, or 7: ")) while num!=2 and num!=4 and num!=7: print("it's not 2 nor 4 and not 7") num = eval(input("Enter 2, 4, or 7: ")) print("It's now either 2 or 4 or 7:", num) size = input("Enter size category (S, M, L): ").upper() while size!='S' and size!='M' and size!='L': print("Invalid size category. Do it again.") size = input("Enter size category (S, M, L): ").upper() print("It's now either S, M, or L:", size)